Commit b02c9893 authored by bitplane's avatar bitplane

Moved the driver dimension restrictions (multiple of two) from the windows...

Moved the driver dimension restrictions (multiple of two) from the windows device into the software drivers.
Added OpenGL 2D drawing accuracy patch by tuXXX.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@850 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8060c6c9
Changes in version 1.4 (... 2007) Changes in version 1.4 (... 2007)
- OpenGL 2D drawing accuracy fix by tuXXX
- Added OnResize and getCurrentRenderTargetSize to the software video drivers. - Added OnResize and getCurrentRenderTargetSize to the software video drivers.
- Added Spot light type for dynamic lights. Note that both position and direction for all dynamic lights are now determined by the LightSceneNode, the SLight attributes are only used for internal purposes. - Added Spot light type for dynamic lights. Note that both position and direction for all dynamic lights are now determined by the LightSceneNode, the SLight attributes are only used for internal purposes.
......
...@@ -600,12 +600,6 @@ void CIrrDeviceWin32::resizeIfNecessary() ...@@ -600,12 +600,6 @@ void CIrrDeviceWin32::resizeIfNecessary()
sprintf(tmp, "Resizing window (%ld %ld)", r.right, r.bottom); sprintf(tmp, "Resizing window (%ld %ld)", r.right, r.bottom);
os::Printer::log(tmp); os::Printer::log(tmp);
if ( r.right % 2 )
r.right += 1;
if ( r.bottom % 2 )
r.bottom += 1;
getVideoDriver()->OnResize(irr::core::dimension2d<irr::s32>(r.right, r.bottom)); getVideoDriver()->OnResize(irr::core::dimension2d<irr::s32>(r.right, r.bottom));
} }
......
This diff is collapsed.
...@@ -732,18 +732,29 @@ void CSoftwareDriver::createPlanes(const core::matrix4& mat) ...@@ -732,18 +732,29 @@ void CSoftwareDriver::createPlanes(const core::matrix4& mat)
//! the window was resized. //! the window was resized.
void CSoftwareDriver::OnResize(const core::dimension2d<s32>& size) void CSoftwareDriver::OnResize(const core::dimension2d<s32>& size)
{ {
// make sure width and height are multiples of 2
core::dimension2d<s32> realSize(size);
if (realSize.Width % 2)
realSize.Width += 1;
if (realSize.Height % 2)
realSize.Height += 1;
if (ScreenSize != realSize)
{
if (ViewPort.getWidth() == ScreenSize.Width && if (ViewPort.getWidth() == ScreenSize.Width &&
ViewPort.getHeight() == ScreenSize.Height) ViewPort.getHeight() == ScreenSize.Height)
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), size);
if (ScreenSize != size)
{ {
ScreenSize = size; ViewPort = core::rect<s32>(core::position2d<s32>(0,0), realSize);
}
ScreenSize = realSize;
bool resetRT = (RenderTargetSurface == BackBuffer); bool resetRT = (RenderTargetSurface == BackBuffer);
BackBuffer->drop(); BackBuffer->drop();
BackBuffer = new CImage(ECF_A1R5G5B5, size); BackBuffer = new CImage(ECF_A1R5G5B5, realSize);
if (resetRT) if (resetRT)
setRenderTarget(BackBuffer); setRenderTarget(BackBuffer);
......
...@@ -299,7 +299,7 @@ bool CSoftwareDriver2::queryFeature(E_VIDEO_DRIVER_FEATURE feature) ...@@ -299,7 +299,7 @@ bool CSoftwareDriver2::queryFeature(E_VIDEO_DRIVER_FEATURE feature)
default: default:
return false; return false;
}; }
} }
...@@ -378,10 +378,8 @@ bool CSoftwareDriver2::setTexture(u32 stage, video::ITexture* texture) ...@@ -378,10 +378,8 @@ bool CSoftwareDriver2::setTexture(u32 stage, video::ITexture* texture)
if (Texture[stage]) if (Texture[stage])
Texture[stage]->grab(); Texture[stage]->grab();
if ( Texture[stage] ) if (Texture[stage])
{
Texmap[stage].Texture = (video::CSoftwareTexture2*) Texture[stage]; Texmap[stage].Texture = (video::CSoftwareTexture2*) Texture[stage];
}
setCurrentShader(); setCurrentShader();
return true; return true;
...@@ -464,7 +462,6 @@ bool CSoftwareDriver2::setRenderTarget(video::ITexture* texture, bool clearBackB ...@@ -464,7 +462,6 @@ bool CSoftwareDriver2::setRenderTarget(video::ITexture* texture, bool clearBackB
else else
{ {
setRenderTarget(BackBuffer); setRenderTarget(BackBuffer);
//setRenderTarget((video::CImage*)0);
} }
if (RenderTargetSurface && (clearBackBuffer || clearZBuffer)) if (RenderTargetSurface && (clearBackBuffer || clearZBuffer))
...@@ -1629,18 +1626,29 @@ void CSoftwareDriver2::draw2DRectangle(SColor color, const core::rect<s32>& pos, ...@@ -1629,18 +1626,29 @@ void CSoftwareDriver2::draw2DRectangle(SColor color, const core::rect<s32>& pos,
//! the window was resized. //! the window was resized.
void CSoftwareDriver2::OnResize(const core::dimension2d<s32>& size) void CSoftwareDriver2::OnResize(const core::dimension2d<s32>& size)
{ {
// make sure width and height are multiples of 2
core::dimension2d<s32> realSize(size);
if (realSize.Width % 2)
realSize.Width += 1;
if (realSize.Height % 2)
realSize.Height += 1;
if (ScreenSize != realSize)
{
if (ViewPort.getWidth() == ScreenSize.Width && if (ViewPort.getWidth() == ScreenSize.Width &&
ViewPort.getHeight() == ScreenSize.Height) ViewPort.getHeight() == ScreenSize.Height)
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), size);
if (ScreenSize != size)
{ {
ScreenSize = size; ViewPort = core::rect<s32>(core::position2d<s32>(0,0), realSize);
}
ScreenSize = realSize;
bool resetRT = (RenderTargetSurface == BackBuffer); bool resetRT = (RenderTargetSurface == BackBuffer);
BackBuffer->drop(); BackBuffer->drop();
BackBuffer = new CImage(ECF_SOFTWARE2, size); BackBuffer = new CImage(ECF_SOFTWARE2, realSize);
if (resetRT) if (resetRT)
setRenderTarget(BackBuffer); setRenderTarget(BackBuffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment