Merge revisions r5416:r5420 from trunk to ogl-es.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5421 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-04-13 12:42:29 +00:00
parent f1ee785039
commit 15128e6e9f
8 changed files with 44 additions and 36 deletions

View File

@ -9,6 +9,7 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- change SEvent::SUserEvent.UserData1 and SEvent::SUserEvent.UserData1 from s32 to size_t to avoid cutting numbers on some 64-bit platforms (SDL and Windows)
- Improve speed of draw3DBox (OpenGL and D3D9). Thanks @zerochen for patch (https://sourceforge.net/p/irrlicht/patches/256)
- Support more keys on OSX "[]\". Thanks @neoascetic for patch (#313).
- Fix IBillboardTextSceneNode::setTextColor which did nothing in the past. It now maps to setColor instead.

View File

@ -536,10 +536,10 @@ struct SEvent
struct SUserEvent
{
//! Some user specified data as int
s32 UserData1;
size_t UserData1;
//! Another user specified data as int
s32 UserData2;
size_t UserData2;
};
// Raw events from the OS

View File

@ -112,26 +112,29 @@ class line2d
}
/*! returns a intersection point of 2 lines (if lines are not parallel). Behaviour
undefined if lines are parallel or coincident.*/
undefined if lines are parallel or coincident.
It's on optimized intersectWith with checkOnlySegments=false and ignoreCoincidentLines=true
*/
vector2d<T> fastLinesIntersection( const line2d<T>& l) const
{
const f32 commonDenominator = (f32)((l.end.Y - l.start.Y)*(end.X - start.X) -
(l.end.X - l.start.X)*(end.Y - start.Y));
if ( commonDenominator != 0.f )
{
const f32 numeratorA = (f32)((l.end.X - l.start.X)*(start.Y - l.start.Y) -
(l.end.Y - l.start.Y)*(start.X - l.start.X));
const f32 numeratorA = (f32)((l.end.X - l.start.X)*(start.Y - l.start.Y) -
(l.end.Y - l.start.Y)*(start.X - l.start.X));
const f32 uA = numeratorA / commonDenominator;
const f32 numeratorB = (f32)((end.X - start.X)*(start.Y - l.start.Y) -
(end.Y - start.Y)*(start.X - l.start.X));
const f32 uA = numeratorA / commonDenominator;
const f32 uB = numeratorB / commonDenominator;
// Calculate the intersection point.
return vector2d<T> (
(T)(start.X + uA * (end.X - start.X)),
(T)(start.Y + uA * (end.Y - start.Y))
);
// Calculate the intersection point.
return vector2d<T> (
(T)(start.X + uA * (end.X - start.X)),
(T)(start.Y + uA * (end.Y - start.Y))
);
}
else
return l.start;
}
/*! Check if this line intersect a segment. The eventual intersection point is returned in "out".*/
@ -235,12 +238,15 @@ class line2d
// Get the point of intersection on this line, checking that
// it is within the line segment.
const f32 uA = numeratorA / commonDenominator;
if(checkOnlySegments && (uA < 0.f || uA > 1.f) )
return false; // Outside the line segment
if (checkOnlySegments)
{
if(uA < 0.f || uA > 1.f)
return false; // Outside the line segment
const f32 uB = numeratorB / commonDenominator;
if(checkOnlySegments && (uB < 0.f || uB > 1.f))
return false; // Outside the line segment
const f32 uB = numeratorB / commonDenominator;
if(uB < 0.f || uB > 1.f)
return false; // Outside the line segment
}
// Calculate the intersection point.
out.X = (T)(start.X + uA * (end.X - start.X));

View File

@ -1035,8 +1035,8 @@ bool CIrrDeviceLinux::run()
{
// we assume it's a user message
irrevent.EventType = irr::EET_USER_EVENT;
irrevent.UserEvent.UserData1 = (s32)event.xclient.data.l[0];
irrevent.UserEvent.UserData2 = (s32)event.xclient.data.l[1];
irrevent.UserEvent.UserData1 = static_cast<size_t>(event.xclient.data.l[0]);
irrevent.UserEvent.UserData2 = static_cast<size_t>(event.xclient.data.l[1]);
postEventFromUser(irrevent);
}
XFree(atom);

View File

@ -470,8 +470,8 @@ bool CIrrDeviceSDL::run()
case SDL_USEREVENT:
irrevent.EventType = irr::EET_USER_EVENT;
irrevent.UserEvent.UserData1 = *(reinterpret_cast<s32*>(&SDL_event.user.data1));
irrevent.UserEvent.UserData2 = *(reinterpret_cast<s32*>(&SDL_event.user.data2));
irrevent.UserEvent.UserData1 = reinterpret_cast<uintptr_t>(SDL_event.user.data1);
irrevent.UserEvent.UserData2 = reinterpret_cast<uintptr_t>(SDL_event.user.data2);
postEventFromUser(irrevent);
break;
@ -646,7 +646,7 @@ bool CIrrDeviceSDL::present(video::IImage* surface, void* windowId, core::rect<s
return true;
#else // !_IRR_EMSCRIPTEN_PLATFORM_
SDL_Surface *sdlSurface = SDL_CreateRGBSurfaceFrom(
surface->lock(), surface->getDimension().Width, surface->getDimension().Height,
surface->getData(), surface->getDimension().Width, surface->getDimension().Height,
surface->getBitsPerPixel(), surface->getPitch(),
surface->getRedMask(), surface->getGreenMask(), surface->getBlueMask(), surface->getAlphaMask());
if (!sdlSurface)
@ -718,7 +718,6 @@ bool CIrrDeviceSDL::present(video::IImage* surface, void* windowId, core::rect<s
}
SDL_FreeSurface(sdlSurface);
surface->unlock();
return (scr != 0);
#endif // !_IRR_EMSCRIPTEN_PLATFORM_
}

View File

@ -967,8 +967,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_USER:
event.EventType = irr::EET_USER_EVENT;
event.UserEvent.UserData1 = (irr::s32)wParam;
event.UserEvent.UserData2 = (irr::s32)lParam;
event.UserEvent.UserData1 = static_cast<size_t>(wParam);
event.UserEvent.UserData2 = static_cast<size_t>(lParam);
dev = getDeviceFromHWnd(hWnd);
if (dev)

View File

@ -56,7 +56,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFil
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), CacheHandler(0),
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
AntiAlias(params.AntiAlias), ColorFormat(ECF_R8G8B8), FixedPipelineState(EOFPS_ENABLE),
Params(params), SDLDevice(device), DeviceType(EIDT_SDL)
Params(params), SDLDevice(device), ContextManager(0), DeviceType(EIDT_SDL)
{
#ifdef _DEBUG
setDebugName("COpenGLDriver");
@ -291,7 +291,8 @@ bool COpenGLDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth,
ContextManager->activateContext(videoData);
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
glFrontFace(GL_CW);
if ( DeviceType == EIDT_SDL )
glFrontFace(GL_CW);
#endif
clearBuffers(clearFlag, clearColor, clearDepth, clearStencil);
@ -311,8 +312,11 @@ bool COpenGLDriver::endScene()
status = ContextManager->swapBuffers();
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
SDL_GL_SwapBuffers();
status = true;
if ( DeviceType == EIDT_SDL )
{
SDL_GL_SwapBuffers();
status = true;
}
#endif
// todo: console device present

View File

@ -190,10 +190,8 @@ REALINLINE void CTRTextureLightMap2_Add::scanline_bilinear ()
#endif
f32 inversew = FIX_POINT_F32_MUL;
#ifdef BURNINGVIDEO_RENDERER_FAST
f32 inversew = FIX_POINT_F32_MUL;
u32 dIndex = ( line.y & 3 ) << 2;