Merging r6140 through r6144 from trunk to ogl-es branch.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6145 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-11-02 22:26:23 +00:00
parent 8b9947f9f6
commit 8557a1f7e6
8 changed files with 74 additions and 21 deletions

@ -9,7 +9,6 @@
#include "ICursorControl.h"
#include "ICameraSceneNode.h"
#include "ISceneNodeAnimatorCollisionResponse.h"
#include "os.h"
namespace irr
{
@ -20,11 +19,21 @@ namespace scene
CSceneNodeAnimatorCameraFPS::CSceneNodeAnimatorCameraFPS(gui::ICursorControl* cursorControl,
f32 rotateSpeed, f32 moveSpeed, f32 jumpSpeed,
SKeyMap* keyMapArray, u32 keyMapSize, bool noVerticalMovement, bool invertY, float rotateSpeedKeyboard)
: CursorControl(cursorControl), MaxVerticalAngle(88.0f), NoVerticalMovement(noVerticalMovement),
MoveSpeed(moveSpeed), RotateSpeedKeyboard(rotateSpeedKeyboard), RotateSpeed(rotateSpeed),
: CursorControl(cursorControl),
// On X11 we get events even when mouse is not inside the Irrlicht window, on Windows we don't.
// It might be possible to add grabbing on Windows as well in which case this has to be somewhat changed.
// TODO: I don't know about OSX, but in theory it should be like old Irrlicht 1.8 behavior whatever that was there.
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
GrabMouse(false),
#else
GrabMouse(true),
#endif
MaxVerticalAngle(88.0f), NoVerticalMovement(noVerticalMovement),
MoveSpeed(moveSpeed),
RotateSpeedKeyboard(rotateSpeedKeyboard), RotateSpeed(rotateSpeed),
JumpSpeed(jumpSpeed),
MouseYDirection(invertY ? -1.0f : 1.0f),
LastAnimationTime(0), firstUpdate(true), firstInput(true)
LastAnimationTime(0), HadMouseEvent(false), firstUpdate(true), firstInput(true)
{
#ifdef _DEBUG
setDebugName("CCameraSceneNodeAnimatorFPS");
@ -80,6 +89,9 @@ bool CSceneNodeAnimatorCameraFPS::OnEvent(const SEvent& evt)
}
}
break;
case EET_MOUSE_INPUT_EVENT:
HadMouseEvent = true;
return true;
case EET_MOUSE_INPUT_EVENT:
if ( evt.MouseInput.Event == EMIE_MOUSE_ENTER_CANVAS && CursorControl)
@ -103,8 +115,6 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
if (!node || node->getType() != ESNT_CAMERA)
return;
timeMs = os::Timer::getRealTime(); // User input is always in real-time
ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node);
if (firstUpdate)
@ -138,9 +148,6 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
if(smgr && smgr->getActiveCamera() != camera)
return;
if ( CursorControl )
CursorPos = CursorControl->getRelativePosition();
// get time
f32 timeDiff = (f32) ( timeMs - LastAnimationTime );
LastAnimationTime = timeMs;
@ -153,6 +160,9 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
{
bool reset = false;
if ( HadMouseEvent || GrabMouse)
CursorPos = CursorControl->getRelativePosition();
if (CursorPos != CenterCursor)
{
relativeRotation.Y -= (CenterCursor.X - CursorPos.X) * RotateSpeed;
@ -161,12 +171,8 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
reset = true;
}
if ( !reset )
if ( GrabMouse && !reset)
{
// TODO: not sure if this case is still needed. Might be it was only something
// that was necessary when someone tried to use mouse-events in the past.
// But not too expensive, test on all platforms before removing.
// Special case, mouse is whipped outside of window before it can update.
video::IVideoDriver* driver = smgr->getVideoDriver();
core::vector2d<u32> mousepos(u32(CursorPos.X), u32(CursorPos.Y));
@ -183,6 +189,7 @@ void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs)
CursorPos = CenterCursor;
}
}
HadMouseEvent = false;
// keyboard rotation
if (CursorKeys[EKA_ROTATE_LEFT])

@ -114,6 +114,7 @@ namespace scene
void allKeysUp();
gui::ICursorControl *CursorControl;
bool GrabMouse;
f32 MaxVerticalAngle;
bool NoVerticalMovement;
@ -129,6 +130,7 @@ namespace scene
core::array<SKeyMap> KeyMap;
core::position2d<f32> CenterCursor, CursorPos;
bool HadMouseEvent;
bool CursorKeys[EKA_COUNT];

@ -374,7 +374,7 @@ CBurningVideoDriver::CBurningVideoDriver(const irr::SIrrlichtCreationParameters&
addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL,
addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_ALPHA_CHANNEL_REF,
addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_VERTEX_ALPHA,
addMaterialRenderer ( smr ); // EMT_TRANSPARENT_REFLECTION_2_LAYER,
addMaterialRenderer ( tmr ); // EMT_TRANSPARENT_REFLECTION_2_LAYER,
addMaterialRenderer ( smr ); // EMT_NORMAL_MAP_SOLID,
addMaterialRenderer ( tmr ); // EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR,
addMaterialRenderer ( tmr ); // EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA,

@ -615,6 +615,17 @@
5E9573D71C18E9E600C27989 /* CEAGLManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E9573D61C18E9E600C27989 /* CEAGLManager.mm */; };
8493BC02249DEBB30092813E /* IOctreeSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 8493BC01249DEBB20092813E /* IOctreeSceneNode.h */; };
8493BC04249DED3F0092813E /* IMemoryReadFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 8493BC03249DED3F0092813E /* IMemoryReadFile.h */; };
84A219A5249F823900E189FC /* SOverrideMaterial.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219A4249F823800E189FC /* SOverrideMaterial.h */; };
84A219AE249F82DD00E189FC /* burning_shader_compile_verify.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219A6249F82DC00E189FC /* burning_shader_compile_verify.h */; };
84A219AF249F82DD00E189FC /* burning_shader_compile_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219A7249F82DC00E189FC /* burning_shader_compile_triangle.h */; };
84A219B0249F82DD00E189FC /* burning_shader_compile_fragment_start.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219A8249F82DC00E189FC /* burning_shader_compile_fragment_start.h */; };
84A219B1249F82DD00E189FC /* burning_shader_color_fraq.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219A9249F82DC00E189FC /* burning_shader_color_fraq.h */; };
84A219B2249F82DD00E189FC /* burning_shader_compile_start.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219AA249F82DC00E189FC /* burning_shader_compile_start.h */; };
84A219B4249F82DD00E189FC /* burning_shader_compile_fragment_default.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219AC249F82DC00E189FC /* burning_shader_compile_fragment_default.h */; };
84A219B5249F82DD00E189FC /* burning_shader_compile_fragment_end.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A219AD249F82DD00E189FC /* burning_shader_compile_fragment_end.h */; };
84A219B7249F82E800E189FC /* burning_shader_color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A219B6249F82E800E189FC /* burning_shader_color.cpp */; };
84A219B9249F834000E189FC /* CTRGouraudNoZ2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A219B8249F834000E189FC /* CTRGouraudNoZ2.cpp */; };
84A219BB249F835B00E189FC /* CTR_transparent_reflection_2_layer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A219BA249F835B00E189FC /* CTR_transparent_reflection_2_layer.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -1370,6 +1381,17 @@
5EC24F5E1B8B861200DCA615 /* exampleHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = exampleHelper.h; path = ../../include/exampleHelper.h; sourceTree = "<group>"; };
8493BC01249DEBB20092813E /* IOctreeSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOctreeSceneNode.h; path = ../../include/IOctreeSceneNode.h; sourceTree = "<group>"; };
8493BC03249DED3F0092813E /* IMemoryReadFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMemoryReadFile.h; path = ../../include/IMemoryReadFile.h; sourceTree = "<group>"; };
84A219A4249F823800E189FC /* SOverrideMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SOverrideMaterial.h; path = ../../include/SOverrideMaterial.h; sourceTree = "<group>"; };
84A219A6249F82DC00E189FC /* burning_shader_compile_verify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_verify.h; sourceTree = "<group>"; };
84A219A7249F82DC00E189FC /* burning_shader_compile_triangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_triangle.h; sourceTree = "<group>"; };
84A219A8249F82DC00E189FC /* burning_shader_compile_fragment_start.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_fragment_start.h; sourceTree = "<group>"; };
84A219A9249F82DC00E189FC /* burning_shader_color_fraq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_color_fraq.h; sourceTree = "<group>"; };
84A219AA249F82DC00E189FC /* burning_shader_compile_start.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_start.h; sourceTree = "<group>"; };
84A219AC249F82DC00E189FC /* burning_shader_compile_fragment_default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_fragment_default.h; sourceTree = "<group>"; };
84A219AD249F82DD00E189FC /* burning_shader_compile_fragment_end.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = burning_shader_compile_fragment_end.h; sourceTree = "<group>"; };
84A219B6249F82E800E189FC /* burning_shader_color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = burning_shader_color.cpp; sourceTree = "<group>"; };
84A219B8249F834000E189FC /* CTRGouraudNoZ2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CTRGouraudNoZ2.cpp; sourceTree = "<group>"; };
84A219BA249F835B00E189FC /* CTR_transparent_reflection_2_layer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CTR_transparent_reflection_2_layer.cpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -1552,6 +1574,7 @@
5E34C7931B7F4AFC00F212E8 /* SMeshBuffer.h */,
5E34C7941B7F4AFC00F212E8 /* SMeshBufferLightMap.h */,
5E34C7951B7F4AFC00F212E8 /* SMeshBufferTangents.h */,
84A219A4249F823800E189FC /* SOverrideMaterial.h */,
5E34C7961B7F4AFC00F212E8 /* SParticle.h */,
5E34C7971B7F4AFC00F212E8 /* SSharedMeshBuffer.h */,
5E34C7981B7F4AFC00F212E8 /* SSkinMeshBuffer.h */,
@ -1584,6 +1607,13 @@
5E34C7A21B7F4C1900F212E8 /* video */ = {
isa = PBXGroup;
children = (
84A219A9249F82DC00E189FC /* burning_shader_color_fraq.h */,
84A219AC249F82DC00E189FC /* burning_shader_compile_fragment_default.h */,
84A219AD249F82DD00E189FC /* burning_shader_compile_fragment_end.h */,
84A219A8249F82DC00E189FC /* burning_shader_compile_fragment_start.h */,
84A219AA249F82DC00E189FC /* burning_shader_compile_start.h */,
84A219A7249F82DC00E189FC /* burning_shader_compile_triangle.h */,
84A219A6249F82DC00E189FC /* burning_shader_compile_verify.h */,
5E34C6EE1B7F4AFB00F212E8 /* EDriverFeatures.h */,
5E34C6EF1B7F4AFB00F212E8 /* EDriverTypes.h */,
5E34C6F41B7F4AFB00F212E8 /* EMaterialFlags.h */,
@ -2222,6 +2252,7 @@
5E34C95A1B7F692C00F212E8 /* Burning Video */ = {
isa = PBXGroup;
children = (
84A219B6249F82E800E189FC /* burning_shader_color.cpp */,
5E34C9601B7F6A7600F212E8 /* CBurningShader_Raster_Reference.cpp */,
5E34C9611B7F6A7600F212E8 /* CDepthBuffer.cpp */,
5E34C9621B7F6A7600F212E8 /* CDepthBuffer.h */,
@ -2233,6 +2264,7 @@
5E34C9681B7F6A7600F212E8 /* CTRGouraud2.cpp */,
5E34C9691B7F6A7600F212E8 /* CTRGouraudAlpha2.cpp */,
5E34C96A1B7F6A7600F212E8 /* CTRGouraudAlphaNoZ2.cpp */,
84A219B8249F834000E189FC /* CTRGouraudNoZ2.cpp */,
5E34C96B1B7F6A7600F212E8 /* CTRNormalMap.cpp */,
5E34C96C1B7F6A7600F212E8 /* CTRStencilShadow.cpp */,
5E34C96D1B7F6A7600F212E8 /* CTRTextureBlend.cpp */,
@ -2250,6 +2282,7 @@
5E34C9791B7F6A7600F212E8 /* CTRTextureLightMap2_M4.cpp */,
5E34C97A1B7F6A7600F212E8 /* CTRTextureLightMapGouraud2_M4.cpp */,
5E34C97B1B7F6A7600F212E8 /* CTRTextureWire2.cpp */,
84A219BA249F835B00E189FC /* CTR_transparent_reflection_2_layer.cpp */,
5E34C97C1B7F6A7600F212E8 /* IBurningShader.cpp */,
5E34C97D1B7F6A7600F212E8 /* IBurningShader.h */,
5E34C97E1B7F6A7600F212E8 /* IDepthBuffer.h */,
@ -2453,7 +2486,15 @@
files = (
5E8570BD1B7F9AC400B267D2 /* CIrrDeviceConsole.h in Headers */,
5E7908961C10EEC000DFE7FE /* COpenGLCommon.h in Headers */,
84A219B2249F82DD00E189FC /* burning_shader_compile_start.h in Headers */,
8493BC04249DED3F0092813E /* IMemoryReadFile.h in Headers */,
84A219B1249F82DD00E189FC /* burning_shader_color_fraq.h in Headers */,
84A219B4249F82DD00E189FC /* burning_shader_compile_fragment_default.h in Headers */,
84A219B5249F82DD00E189FC /* burning_shader_compile_fragment_end.h in Headers */,
84A219A5249F823900E189FC /* SOverrideMaterial.h in Headers */,
84A219AE249F82DD00E189FC /* burning_shader_compile_verify.h in Headers */,
84A219AF249F82DD00E189FC /* burning_shader_compile_triangle.h in Headers */,
84A219B0249F82DD00E189FC /* burning_shader_compile_fragment_start.h in Headers */,
5E7908951C10EEC000DFE7FE /* COpenGLCacheHandler.h in Headers */,
8493BC02249DEBB30092813E /* IOctreeSceneNode.h in Headers */,
);
@ -2509,7 +2550,8 @@
5E34C6D91B7F4A0C00F212E8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0830;
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1150;
TargetAttributes = {
5E34C9F21B7F6E3400F212E8 = {
CreatedOnToolsVersion = 6.1;
@ -2585,6 +2627,7 @@
5E34CA4F1B7F6EBF00F212E8 /* CXMLWriter.cpp in Sources */,
5E34CA511B7F6EBF00F212E8 /* CZipReader.cpp in Sources */,
5E34CA541B7F6EBF00F212E8 /* irrXML.cpp in Sources */,
84A219B7249F82E800E189FC /* burning_shader_color.cpp in Sources */,
5E34CA591B7F6EBF00F212E8 /* CIrrDeviceStub.cpp in Sources */,
5E34CA5C1B7F6EBF00F212E8 /* aescrypt.cpp in Sources */,
5E34CA5D1B7F6EBF00F212E8 /* aeskey.cpp in Sources */,
@ -2709,6 +2752,7 @@
5E34CB121B7F6EC200F212E8 /* CIrrMeshFileLoader.cpp in Sources */,
5E34CB141B7F6EC200F212E8 /* CLMTSMeshFileLoader.cpp in Sources */,
5E34CB161B7F6EC200F212E8 /* CLWOMeshFileLoader.cpp in Sources */,
84A219BB249F835B00E189FC /* CTR_transparent_reflection_2_layer.cpp in Sources */,
5E34CB181B7F6EC200F212E8 /* CMD2MeshFileLoader.cpp in Sources */,
5E34CB1A1B7F6EC200F212E8 /* CMD3MeshFileLoader.cpp in Sources */,
5E34CB1C1B7F6EC200F212E8 /* CMeshTextureLoader.cpp in Sources */,
@ -2794,6 +2838,7 @@
5E34CBAA1B7F6EC500F212E8 /* CTRTextureWire2.cpp in Sources */,
5E34CBAB1B7F6EC500F212E8 /* IBurningShader.cpp in Sources */,
5E34CBB11B7F6EC500F212E8 /* CImageLoaderBMP.cpp in Sources */,
84A219B9249F834000E189FC /* CTRGouraudNoZ2.cpp in Sources */,
5E34CBB31B7F6EC500F212E8 /* CImageLoaderDDS.cpp in Sources */,
5E34CBB51B7F6EC600F212E8 /* CImageLoaderJPG.cpp in Sources */,
5E34CBB71B7F6EC600F212E8 /* CImageLoaderPCX.cpp in Sources */,
@ -3186,6 +3231,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
@ -3221,6 +3267,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INSTALL_PATH = /;
MACOSX_DEPLOYMENT_TARGET = 10.9;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-U__STRICT_ANSI__",
@ -3232,7 +3279,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@ -3267,7 +3313,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@ -3278,7 +3323,6 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DSTROOT = "$(SRCROOT)/../../lib/OSX";
ENABLE_NS_ASSERTIONS = NO;
@ -3299,7 +3343,7 @@
5E5733E31C18E212003F664E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ALWAYS_SEARCH_USER_PATHS = NO;f
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@ -1,4 +1,4 @@
Tests finished. 72 tests of 72 passed.
Compiled as RELEASE
Test suite pass at GMT Sun Feb 23 02:59:02 2020
Test suite pass at GMT Sun Oct 25 15:03:26 2020