Commit c2b3d99f authored by bitplane's avatar bitplane

Added OnResize and getCurrentRenderTargetSize to the software drivers. Fix for...

Added OnResize and getCurrentRenderTargetSize to the software drivers. Fix for GUI XML loading by CuteAlien.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@848 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5cba0034
Changes in version 1.4 (... 2007) Changes in version 1.4 (... 2007)
- 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.
API change! One can easily work around this change by setting the LightSceneNode's Position and Rotation instead of the SLight's. This change won't provoke a compile error, though, and can hence go unrecognized besides the visual problems. API change! One can easily work around this change by setting the LightSceneNode's Position and Rotation instead of the SLight's. This change won't provoke a compile error, though, and can hence go unrecognized besides the visual problems.
The lights use a default direction (0,0,-1) which is rotated by the usual scene node transformations and can hence be modified by scene node animators. The lights use a default direction (0,0,-1) which is rotated by the usual scene node transformations and can hence be modified by scene node animators.
......
...@@ -685,7 +685,7 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent) ...@@ -685,7 +685,7 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
if (!file) if (!file)
{ {
os::Printer::log("Unable to open gui file", ELL_ERROR); os::Printer::log("Unable to open GUI file", ELL_ERROR);
return false; return false;
} }
...@@ -719,11 +719,10 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent ...@@ -719,11 +719,10 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent
gui::IGUIElement* node = 0; gui::IGUIElement* node = 0;
if (reader->getNodeType() == io::EXN_NONE) io::EXML_NODE nodeType = reader->getNodeType();
reader->read();
if (reader->getNodeType() == io::EXN_UNKNOWN) if (nodeType == io::EXN_NONE || nodeType == io::EXN_UNKNOWN || nodeType == io::EXN_ELEMENT_END)
reader->read(); return;
if (!parent && !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName())) if (!parent && !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))
{ {
......
...@@ -179,7 +179,7 @@ namespace gui ...@@ -179,7 +179,7 @@ namespace gui
const core::rect<s32>* clip=0); const core::rect<s32>* clip=0);
//! draws an icon, usually from the skin's sprite bank //! draws an icon, usually from the skin's sprite bank
/** \param parent: Pointer to the element which wishes to draw this icon. /** \param element: Pointer to the element which wishes to draw this icon.
This parameter is usually not used by IGUISkin, but can be used for example This parameter is usually not used by IGUISkin, but can be used for example
by more complex implementations to find out how to draw the part exactly. by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn. \param icon: Specifies the icon to be drawn.
......
...@@ -728,6 +728,35 @@ void CSoftwareDriver::createPlanes(const core::matrix4& mat) ...@@ -728,6 +728,35 @@ void CSoftwareDriver::createPlanes(const core::matrix4& mat)
//! Only used by the internal engine. Used to notify the driver that
//! the window was resized.
void CSoftwareDriver::OnResize(const core::dimension2d<s32>& size)
{
if (ViewPort.getWidth() == ScreenSize.Width &&
ViewPort.getHeight() == ScreenSize.Height)
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), size);
if (ScreenSize != size)
{
ScreenSize = size;
bool resetRT = (RenderTargetSurface == BackBuffer);
BackBuffer->drop();
BackBuffer = new CImage(ECF_A1R5G5B5, size);
if (resetRT)
setRenderTarget(BackBuffer);
}
}
//! returns the current render target size
core::dimension2d<s32> CSoftwareDriver::getCurrentRenderTargetSize()
{
return RenderTargetSize;
}
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CSoftwareDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos, void CSoftwareDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
......
...@@ -45,6 +45,13 @@ namespace video ...@@ -45,6 +45,13 @@ namespace video
//! clears the zbuffer //! clears the zbuffer
virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color); virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color);
//! Only used by the internal engine. Used to notify the driver that
//! the window was resized.
virtual void OnResize(const core::dimension2d<s32>& size);
//! returns size of the current render target
virtual core::dimension2d<s32> getCurrentRenderTargetSize();
//! draws a vertex primitive list //! draws a vertex primitive list
void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType); void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);
......
...@@ -1625,7 +1625,33 @@ void CSoftwareDriver2::draw2DRectangle(SColor color, const core::rect<s32>& pos, ...@@ -1625,7 +1625,33 @@ void CSoftwareDriver2::draw2DRectangle(SColor color, const core::rect<s32>& pos,
} }
} }
//! Only used by the internal engine. Used to notify the driver that
//! the window was resized.
void CSoftwareDriver2::OnResize(const core::dimension2d<s32>& size)
{
if (ViewPort.getWidth() == ScreenSize.Width &&
ViewPort.getHeight() == ScreenSize.Height)
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), size);
if (ScreenSize != size)
{
ScreenSize = size;
bool resetRT = (RenderTargetSurface == BackBuffer);
BackBuffer->drop();
BackBuffer = new CImage(ECF_SOFTWARE2, size);
if (resetRT)
setRenderTarget(BackBuffer);
}
}
//! returns the current render target size
core::dimension2d<s32> CSoftwareDriver2::getCurrentRenderTargetSize()
{
return RenderTargetSize;
}
//!Draws an 2d rectangle with a gradient. //!Draws an 2d rectangle with a gradient.
void CSoftwareDriver2::draw2DRectangle(const core::rect<s32>& position, void CSoftwareDriver2::draw2DRectangle(const core::rect<s32>& position,
......
...@@ -47,6 +47,13 @@ namespace video ...@@ -47,6 +47,13 @@ namespace video
//! clears the zbuffer //! clears the zbuffer
virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color); virtual bool beginScene(bool backBuffer, bool zBuffer, SColor color);
//! Only used by the internal engine. Used to notify the driver that
//! the window was resized.
virtual void OnResize(const core::dimension2d<s32>& size);
//! returns size of the current render target
virtual core::dimension2d<s32> getCurrentRenderTargetSize();
//! deletes all dynamic lights there are //! deletes all dynamic lights there are
virtual void deleteAllDynamicLights(); virtual void deleteAllDynamicLights();
......
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