some refactoring
hopefully improved rendering speed added support to add .obj obstacles
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <Indoor/geo/Point2.h>
|
||||
#include <Indoor/geo/Point3.h>
|
||||
#include <Indoor/geo/BBox2.h>
|
||||
|
||||
#include "Scaler.h"
|
||||
|
||||
@@ -30,6 +31,22 @@ public:
|
||||
|
||||
int height() {return h;}
|
||||
|
||||
/** is the given point visible on screen? */
|
||||
bool isVisible(const Point2 p) {
|
||||
const float x = s.xms(p.x);
|
||||
const float y = s.yms(p.y);
|
||||
return (x >= 0 && y >= 0 && x < w && y < h);
|
||||
}
|
||||
|
||||
/** is the given volume visible on screen? */
|
||||
bool isVisible(const BBox2 bb) {
|
||||
const BBox2 bbt(0,0,w,h);
|
||||
BBox2 bbs;
|
||||
bbs.add(s.xms(bb.getMin().x), s.yms(bb.getMin().y)); // y might be inverted! -> use the add() method to address this
|
||||
bbs.add(s.xms(bb.getMax().x), s.yms(bb.getMax().y)); // y might be inverted! -> use the add() method to address this
|
||||
return bbt.intersects(bbs);
|
||||
}
|
||||
|
||||
void drawLine(const Point2 p1, const Point2 p2) {
|
||||
p->drawLine(s.xms(p1.x), s.yms(p1.y), s.xms(p2.x), s.yms(p2.y));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user