Пример #1
0
// Draw all the Nebulae
void NebulaMgr::draw(StelCore* core)
{
	const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
	StelPainter sPainter(prj);

	StelSkyDrawer* skyDrawer = core->getSkyDrawer();

	Nebula::hintsBrightness = hintsFader.getInterstate()*flagShow.getInterstate();

	sPainter.enableTexture2d(true);
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE, GL_ONE);

	// Use a 1 degree margin
	const double margin = 1.*M_PI/180.*prj->getPixelPerRadAtCenter();
	const SphericalRegionP& p = prj->getViewportConvexPolygon(margin, margin);

	// Print all the nebulae of all the selected zones
	float maxMagHints = skyDrawer->getLimitMagnitude()*1.2f-2.f+(hintsAmount*1.2f)-2.f;
	float maxMagLabels = skyDrawer->getLimitMagnitude()-2.f+(labelsAmount*1.2f)-2.f;
	sPainter.setFont(nebulaFont);
	DrawNebulaFuncObject func(maxMagHints, maxMagLabels, &sPainter, core, hintsFader.getInterstate()>0.0001);
	nebGrid.processIntersectingRegions(p, func);

	if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer())
		drawPointer(core, sPainter);
}
// Draw constellations art textures
void ConstellationMgr::drawArt(StelRenderer* renderer, StelProjectorP projector) const
{
	renderer->setBlendMode(BlendMode_Add);

	vector < Constellation * >::const_iterator iter;
	SphericalRegionP region = projector->getViewportConvexPolygon();
	for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
	{
		Constellation* cons = *iter;

		if(NULL == cons->artTexture && !cons->artTexturePath.isEmpty())
		{
			cons->artTexture = renderer->createTexture(cons->artTexturePath);
		}
		if(NULL == cons->artVertices)
		{
			// Tesselate on the plane assuming a tangential projection for the image
			const int resolution = 5;
			cons->generateArtVertices(renderer, resolution);
		}

		cons->drawArtOptim(renderer, projector, *region);
	}
}