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 <stdio.h>
#include <QDebug> #include <QDebug>
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 54 skipping to change at line 55
{ {
initCtor(); initCtor();
initFromQVariantMap(map); initFromQVariantMap(map);
} }
// Destructor // Destructor
StelSkyPolygon::~StelSkyPolygon() StelSkyPolygon::~StelSkyPolygon()
{ {
} }
void StelSkyPolygon::draw(StelCore* core, StelRenderer* renderer, StelProje ctorP projector, float) void StelSkyPolygon::draw(StelCore* core, StelPainter& sPainter, float)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000)
;
QMultiMap<double, StelSkyPolygon*> result; QMultiMap<double, StelSkyPolygon*> result;
getTilesToDraw(result, core, projector->getViewportConvexPolygon(0, 0), true); getTilesToDraw(result, core, prj->getViewportConvexPolygon(0, 0), tr ue);
// Draw in the right order // Draw in the good order
renderer->setBlendMode(BlendMode_Add); sPainter.enableTexture2d(false);
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(renderer, projector); i.value()->drawTile(core);
} }
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 158 skipping to change at line 162
} }
} }
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(StelRenderer* renderer, StelProjectorP projec tor) bool StelSkyPolygon::drawTile(StelCore* core)
{ {
if (!texFader) if (!texFader)
{ {
texFader = new QTimeLine(1000, this); texFader = new QTimeLine(1000, this);
texFader->start(); texFader->start();
} }
for(int poly = 0; poly < skyConvexPolygons.size(); ++poly) StelPainter sPainter(core->getProjection(StelCore::FrameJ2000));
{
skyConvexPolygons[poly].drawFill(renderer, SphericalRegion:: foreach (const SphericalConvexPolygon& poly, skyConvexPolygons)
DrawParams(&(*projector))); sPainter.drawSphericalRegion(&poly);
}
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. 
12 lines changed or deleted 16 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/