StelSkyPolygon.cpp   StelSkyPolygon.cpp 
skipping to change at line 19 skipping to change at line 19
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "renderer/StelRenderer.hpp"
#include "StelSkyPolygon.hpp" #include "StelSkyPolygon.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelPainter.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include <stdexcept> #include <stdexcept>
#include <QDebug> #include <QDebug>
#include <QtOpenGL>
void StelSkyPolygon::initCtor() void StelSkyPolygon::initCtor()
{ {
minResolution = -1; minResolution = -1;
texFader = NULL; texFader = NULL;
} }
// Constructor // Constructor
StelSkyPolygon::StelSkyPolygon(const QString& url, StelSkyPolygon* parent) : MultiLevelJsonBase(parent) StelSkyPolygon::StelSkyPolygon(const QString& url, StelSkyPolygon* parent) : MultiLevelJsonBase(parent)
{ {
skipping to change at line 55 skipping to change at line 54
{ {
initCtor(); initCtor();
initFromQVariantMap(map); initFromQVariantMap(map);
} }
// Destructor // Destructor
StelSkyPolygon::~StelSkyPolygon() StelSkyPolygon::~StelSkyPolygon()
{ {
} }
void StelSkyPolygon::draw(StelCore* core, StelPainter& sPainter, float) void StelSkyPolygon::draw(StelCore* core, StelRenderer* renderer, StelProje ctorP projector, float)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000)
;
QMultiMap<double, StelSkyPolygon*> result; QMultiMap<double, StelSkyPolygon*> result;
getTilesToDraw(result, core, prj->getViewportConvexPolygon(0, 0), tr ue); getTilesToDraw(result, core, projector->getViewportConvexPolygon(0, 0), true);
// Draw in the good order // Draw in the right order
sPainter.enableTexture2d(false); renderer->setBlendMode(BlendMode_Add);
glBlendFunc(GL_ONE, GL_ONE);
QMap<double, StelSkyPolygon*>::Iterator i = result.end(); QMap<double, StelSkyPolygon*>::Iterator i = result.end();
while (i!=result.begin()) while (i!=result.begin())
{ {
--i; --i;
i.value()->drawTile(core); i.value()->drawTile(renderer, projector);
} }
deleteUnusedSubTiles(); deleteUnusedSubTiles();
} }
// Return the list of tiles which should be drawn. // Return the list of tiles which should be drawn.
void StelSkyPolygon::getTilesToDraw(QMultiMap<double, StelSkyPolygon*>& res ult, StelCore* core, const SphericalRegionP& viewPortPoly, bool recheckInte rsect) void StelSkyPolygon::getTilesToDraw(QMultiMap<double, StelSkyPolygon*>& res ult, StelCore* core, const SphericalRegionP& viewPortPoly, bool recheckInte rsect)
{ {
// An error occured during loading // An error occured during loading
if (errorOccured) if (errorOccured)
skipping to change at line 162 skipping to change at line 158
} }
} }
else else
{ {
scheduleChildsDeletion(); scheduleChildsDeletion();
} }
} }
// Draw the image on the screen. // Draw the image on the screen.
// Assume GL_TEXTURE_2D is enabled // Assume GL_TEXTURE_2D is enabled
bool StelSkyPolygon::drawTile(StelCore* core) bool StelSkyPolygon::drawTile(StelRenderer* renderer, StelProjectorP projec tor)
{ {
if (!texFader) if (!texFader)
{ {
texFader = new QTimeLine(1000, this); texFader = new QTimeLine(1000, this);
texFader->start(); texFader->start();
} }
StelPainter sPainter(core->getProjection(StelCore::FrameJ2000)); for(int poly = 0; poly < skyConvexPolygons.size(); ++poly)
{
foreach (const SphericalConvexPolygon& poly, skyConvexPolygons) skyConvexPolygons[poly].drawFill(renderer, SphericalRegion::
sPainter.drawSphericalRegion(&poly); DrawParams(&(*projector)));
}
return true; return true;
} }
// Load the tile from a valid QVariantMap // Load the tile from a valid QVariantMap
void StelSkyPolygon::loadFromQVariantMap(const QVariantMap& map) void StelSkyPolygon::loadFromQVariantMap(const QVariantMap& map)
{ {
if (map.contains("imageCredits")) if (map.contains("imageCredits"))
{ {
QVariantMap dsCredits = map.value("imageCredits").toMap(); QVariantMap dsCredits = map.value("imageCredits").toMap();
 End of changes. 10 change blocks. 
16 lines changed or deleted 12 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/