Merge revision 4802:4812 from trunk to ogl-es:

- Fix serializing colors as strings and add a general test for serializing attributes as strings.
- Link to X11 on c::b project file for tests (got changed recently in other project files).
- Fix IAttributes::setAttribute implementation for textures (did do nothing before).
- Fix recently introduced crash when there is no hovered element but a focused gui element. Thanks @  christianclavet for reporting.
- Fixed D3D8 compilation issues.
- Fixed one problem with Borland compiler, but gave up after that. (Borland 5.5 just doesn't cut it anymore).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4852 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2014-05-08 17:34:24 +00:00
parent c8d1310f84
commit bf9f3a3b5d
8 changed files with 61 additions and 7 deletions

View File

@ -7,6 +7,8 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Fix serializing colors as strings. Was previously mixing up strings with number-arrays and hex color values. Now using hex color values always, but also fixed the the handling when it get's number-array strings.
- Fix IAttributes::setAttribute implementation for textures (did do nothing before).
- Added support for separate blending in OpenGL and D3D9 drivers.
- Added pack_textureBlendFuncSeparate and unpack_textureBlendFuncSeparate functions, which allow to use separate blending functions in OpenGL.
- Added BlendFactor field to SMaterial which allow user to set blending factor per SMaterial set call without use EMT_ONETEXTURE_BLEND type.

View File

@ -1268,6 +1268,14 @@ public:
setInt((s32)floatValue);
}
virtual core::stringc getString() _IRR_OVERRIDE_
{
char tmp[10];
const video::SColor c = getColor();
sprintf(tmp, "%02x%02x%02x%02x", c.getAlpha(), c.getRed(), c.getGreen(), c.getBlue());
return core::stringc(tmp);
}
virtual core::stringw getStringW() _IRR_OVERRIDE_
{
char tmp[10];
@ -1279,7 +1287,9 @@ public:
virtual void setString(const char* text) _IRR_OVERRIDE_
{
u32 c;
if (sscanf(text, "%08x", &c)!=1)
int characters;
int items = sscanf(text, "%08x%n", &c, &characters);
if (items != 1 || characters != 8 )
{
CNumbersAttribute::setString(text);
}
@ -1934,7 +1944,13 @@ public:
}
}
virtual void setTexture(video::ITexture* value)
virtual void setTexture(video::ITexture* texture, const path& filename) _IRR_OVERRIDE_
{
OverrideName = filename;
setTexture(texture);
};
void setTexture(video::ITexture* value)
{
if ( value == Value )
return;

View File

@ -118,7 +118,7 @@ public:
Driver->getBridgeCalls()->setBlendFunc(Driver->getD3DBlend(srcFact), Driver->getD3DBlend(dstFact));
setTextureColorStage(pID3DDevice, 0,
D3DTA_TEXTURE, CD3D8MaterialRenderer::getD3DModulate(modulate), D3DTA_DIFFUSE);
D3DTA_TEXTURE, Driver->getD3DModulate(modulate), D3DTA_DIFFUSE);
if ( alphaSource && (textureBlendFunc_hasAlpha ( srcFact ) || textureBlendFunc_hasAlpha ( dstFact ) ))
{

View File

@ -355,7 +355,7 @@ EGUI_BUTTON_IMAGE_STATE CGUIButton::getImageState(bool pressed) const
// figure state we should have
EGUI_BUTTON_IMAGE_STATE state = EGBIS_IMAGE_DISABLED;
bool focused = Environment->hasFocus(this);
bool mouseOver = Environment->getHovered() == this;
bool mouseOver = static_cast<const IGUIElement*>(Environment->getHovered()) == this; // (static cast for Borland)
if (isEnabled())
{
if ( pressed )

View File

@ -580,7 +580,7 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
IGUIElement * focusCandidate = Hovered;
// Only allow enabled elements to be focused (unless EFF_CAN_FOCUS_DISABLED is set)
if ( !Hovered->isEnabled() && !(FocusFlags & EFF_CAN_FOCUS_DISABLED))
if ( Hovered && !Hovered->isEnabled() && !(FocusFlags & EFF_CAN_FOCUS_DISABLED))
focusCandidate = NULL; // we still remove focus from the active element
// Please don't merge this into a single if clause, it's easier to debug the way it is

View File

@ -49,7 +49,7 @@ int main(int argumentCount, char * arguments[])
// Note that to interactively debug a test, you will generally want to move it
// (temporarily) to the beginning of the list, since each test runs in its own
// process.
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
// Now the simple tests without device
TEST(testIrrArray);
@ -84,7 +84,7 @@ int main(int argumentCount, char * arguments[])
TEST(sceneNodeAnimator);
TEST(meshLoaders);
TEST(testTimer);
TEST(testCoreutil);
TEST(testCoreutil);
// software drivers only
TEST(softwareDevice);
TEST(b3dAnimation);

View File

@ -297,6 +297,34 @@ bool XmlSerialization(io::IFileSystem * fs, video::IVideoDriver * driver )
return origMock == copyMock;
}
// All attributes can also be read/written in string format
bool stringSerialization(io::IFileSystem * fs)
{
SerializableMock mock;
mock.set();
io::IAttributes* attr = fs->createEmptyAttributes();
mock.serializeAttributes(attr, 0);
for ( s32 i=0; i< (s32)attr->getAttributeCount(); ++i )
{
core::stringw value(attr->getAttributeAsString(i));
attr->setAttribute(i, value.c_str() );
core::stringw value2(attr->getAttributeAsString(i));
if ( value != value2 )
{
logTestString("old-string: %s new-string: %s for %d.%s in %s:%d\n"
, core::stringc(value).c_str(), core::stringc(value2).c_str(), i, attr->getAttributeName(i), __FILE__, __LINE__ );
return false;
}
}
attr->drop();
return true;
}
bool serializeAttributes()
{
bool result = true;
@ -327,6 +355,12 @@ bool serializeAttributes()
logTestString("XmlSerialization failed in %s:%d\n", __FILE__, __LINE__ );
}
result &= stringSerialization(fs);
if ( !result )
{
logTestString("stringSerialization failed in %s:%d\n", __FILE__, __LINE__ );
}
device->closeDevice();
device->run();
device->drop();

View File

@ -45,6 +45,7 @@
<Linker>
<Add library="Xxf86vm" />
<Add library="GL" />
<Add library="X11" />
<Add directory="../lib/Linux/" />
</Linker>
</Target>
@ -62,6 +63,7 @@
<Linker>
<Add library="Xxf86vm" />
<Add library="GL" />
<Add library="X11" />
<Add directory="../lib/Linux/" />
</Linker>
</Target>