Small fix in the osgjs plugin. Since osgjs uses pixel area for PIXEL_SIZE_ON_SCREEN PagedLOD ranges instead of a diameter, it's a more correct approximation to square the ranges in this case.

This commit is contained in:
Andreas Ekstrand
2018-01-10 11:07:46 +00:00
committed by Robert Osfield
parent df280811a1
commit 0eacd8161a

View File

@@ -871,7 +871,15 @@ JSONObject* WriteVisitor::createJSONPagedLOD(osg::PagedLOD *plod)
ss << "Range ";
ss << i;
std::string str = ss.str();
rangeObject->getMaps()[str] = new JSONVec2Array(osg::Vec2(plod->getRangeList()[i].first, plod->getRangeList()[i].second));
osg::Vec2 range(plod->getRangeList()[i].first, plod->getRangeList()[i].second);
// Since OSGJS uses pixel area, use square range
if (plod->getRangeMode() == osg::LOD::PIXEL_SIZE_ON_SCREEN) {
range.set(pow(range.x(), 2.0f), pow(range.y(), 2.0f));
}
rangeObject->getMaps()[str] = new JSONVec2Array(range);
}
jsonPlod->getMaps()["RangeList"] = rangeObject;
// File List