Code: Select all
#include <iostream>
#include "irrlicht/irrlicht.h"
int main()
{
using namespace irr;
using namespace core;
rect<f32>* validRect = new rect<f32>(position2d<f32>(0, 0), dimension2d<f32>(2, 2)); //works
rect<f32>* invalidRect = new rect<f32>(position2d<f32>(-1, 1), position2d<f32>(1, -1)); //doesn't work
std::cout << "validRect: " << validRect->isValid() << "\n";
std::cout << "invalidRect: " << invalidRect->isValid() << "\n";
std::cout << "\n";
std::cout << "validWidth: " << validRect->getWidth() << ", validHeight: " << validRect->getHeight() << "\n";
std::cout << "invalidWidth: " << invalidRect->getWidth() << ", invalidHeight: " << invalidRect->getHeight() << "\n";
int tempInt;
std::cin >> tempInt;
return 1;
}
Code: Select all
(-1, 1)----------(1, 1)
| |
| |
| |
(-1, -1)---------(1, -1)
The problem is in rect.h, where isValid() tests if LowerRightCorner.X >= UpperLeftCorner.X (which is fine), but it's also testing for LowerRightCorner.Y >= UpperLeftCorner.Y. Why would we test if the lower y coordinate is greater than the upper y coordinate? :\
This problem is also found in several other fuctions.
The reason that the rectangle
Code: Select all
rect<f32>* validRect = new rect<f32>(position2d<f32>(0, 0), dimension2d<f32>(2, 2));
I'll provide a full patch later so that if this is truly a bug it can be fixed quickly
Thanks
-wyrmmage