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
master
bitplane 2007-08-20 10:11:55 +00:00
parent 5cba00344b
commit c2b3d99f6a
7 changed files with 76 additions and 6 deletions

View File

@ -1,5 +1,7 @@
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.
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.

View File

@ -685,7 +685,7 @@ bool CGUIEnvironment::loadGUI(io::IReadFile* file, IGUIElement* parent)
if (!file)
{
os::Printer::log("Unable to open gui file", ELL_ERROR);
os::Printer::log("Unable to open GUI file", ELL_ERROR);
return false;
}
@ -719,11 +719,10 @@ void CGUIEnvironment::readGUIElement(io::IXMLReader* reader, IGUIElement* parent
gui::IGUIElement* node = 0;
if (reader->getNodeType() == io::EXN_NONE)
reader->read();
io::EXML_NODE nodeType = reader->getNodeType();
if (reader->getNodeType() == io::EXN_UNKNOWN)
reader->read();
if (nodeType == io::EXN_NONE || nodeType == io::EXN_UNKNOWN || nodeType == io::EXN_ELEMENT_END)
return;
if (!parent && !wcscmp(IRR_XML_FORMAT_GUI_ENV, reader->getNodeName()))
{

View File

@ -179,7 +179,7 @@ namespace gui
const core::rect<s32>* clip=0);
//! 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
by more complex implementations to find out how to draw the part exactly.
\param icon: Specifies the icon to be drawn.

View File

@ -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.
void CSoftwareDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect,

View File

@ -45,6 +45,13 @@ namespace video
//! clears the zbuffer
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
void drawVertexPrimitiveList(const void* vertices, u32 vertexCount, const u16* indexList, u32 primitiveCount, E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType);

View File

@ -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.
void CSoftwareDriver2::draw2DRectangle(const core::rect<s32>& position,

View File

@ -47,6 +47,13 @@ namespace video
//! clears the zbuffer
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
virtual void deleteAllDynamicLights();