当前位置: 首页>>代码示例>>C++>>正文


C++ StelPainter::setColor方法代码示例

本文整理汇总了C++中StelPainter::setColor方法的典型用法代码示例。如果您正苦于以下问题:C++ StelPainter::setColor方法的具体用法?C++ StelPainter::setColor怎么用?C++ StelPainter::setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StelPainter的用法示例。


在下文中一共展示了StelPainter::setColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawPointer

void NebulaMgr::drawPointer(const StelCore* core, StelPainter& sPainter)
{
	const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);

	const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)->getSelectedObject("Nebula");
	if (!newSelected.empty())
	{
		const StelObjectP obj = newSelected[0];
		Vec3d pos=obj->getJ2000EquatorialPos(core);

		// Compute 2D pos and return if outside screen
		if (!prj->projectInPlace(pos)) return;		
		if (StelApp::getInstance().getVisionModeNight())
			sPainter.setColor(0.8f,0.0f,0.0f);
		else
			sPainter.setColor(0.4f,0.5f,0.8f);

		texPointer->bind();

		sPainter.enableTexture2d(true);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode

		// Size on screen
		float size = obj->getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter();

		size+=20.f + 10.f*std::sin(2.f * StelApp::getInstance().getTotalRunTime());
		sPainter.drawSprite2dMode(pos[0]-size/2, pos[1]-size/2, 10, 90);
		sPainter.drawSprite2dMode(pos[0]-size/2, pos[1]+size/2, 10, 0);
		sPainter.drawSprite2dMode(pos[0]+size/2, pos[1]+size/2, 10, -90);
		sPainter.drawSprite2dMode(pos[0]+size/2, pos[1]-size/2, 10, -180);
	}
}
开发者ID:ammarshadiq,项目名称:stellarium-0.11.4,代码行数:33,代码来源:NebulaMgr.cpp

示例2: draw

void Quasar::draw(StelCore* core, StelPainter& painter)
{
	StelSkyDrawer* sd = core->getSkyDrawer();

	Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;
	Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);
	if (StelApp::getInstance().getVisionModeNight())
		dcolor = StelUtils::getNightColor(dcolor);

	float rcMag[2], size, shift;
	double mag;

	StelUtils::spheToRect(qRA, qDE, XYZ);
        mag = getVMagnitude(core, true);	

	if (GETSTELMODULE(Quasars)->getDisplayMode())
	{
		glEnable(GL_BLEND);
		glBlendFunc(GL_ONE, GL_ONE);
		painter.setColor(dcolor[0], dcolor[1], dcolor[2], 1);

		Quasar::markerTexture->bind();
		size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
		shift = 5.f + size/1.6f;
		if (labelsFader.getInterstate()<=0.f)
		{
			painter.drawSprite2dMode(XYZ, 4);
			painter.drawText(XYZ, " ", 0, shift, shift, false);
		}
	}
	else
	{
		sd->preDrawPointSource(&painter);
	
		if (mag <= sd->getLimitMagnitude())
		{
			sd->computeRCMag(mag, rcMag);
			//sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, sd->indexToColor(BvToColorIndex(bV)), false);
			sd->drawPointSource(&painter, XYZ, rcMag, sd->indexToColor(BvToColorIndex(bV)), false);
			painter.setColor(color[0], color[1], color[2], 1);
			size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
			shift = 6.f + size/1.8f;
			if (labelsFader.getInterstate()<=0.f)
			{
				painter.drawText(XYZ, designation, 0, shift, shift, false);
			}
		}

		sd->postDrawPointSource(&painter);
	}
}
开发者ID:ammarshadiq,项目名称:stellarium-0.11.4,代码行数:51,代码来源:Quasar.cpp

示例3: drawComa

void Comet::drawComa(StelCore* core, StelProjector::ModelViewTranformP transfo)
{
	// Find rotation matrix from 0/0/1 to viewdirection! crossproduct for axis (normal vector), dotproduct for angle.
	Vec3d eclposNrm=eclipticPos - core->getObserverHeliocentricEclipticPos()  ; eclposNrm.normalize();
	Mat4d comarot=Mat4d::rotation(Vec3d(0.0, 0.0, 1.0)^(eclposNrm), std::acos(Vec3d(0.0, 0.0, 1.0).dot(eclposNrm)) );
	StelProjector::ModelViewTranformP transfo2 = transfo->clone();
	transfo2->combine(comarot);
	StelPainter* sPainter = new StelPainter(core->getProjection(transfo2));

	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE, GL_ONE);
	glDisable(GL_CULL_FACE);

	// GZ: For the coma, we can use extinction via atmosphere.
	// In addition, light falloff is a bit reduced for better visibility. Power basis should be 0.4, we use 0.6.
	float minSkyMag=core->getSkyDrawer()->getLimitMagnitude();
	float mag100pct=minSkyMag-6.0f; // should be 5, but let us draw it a bit brighter.
	float magDrop=getVMagnitudeWithExtinction(core)-mag100pct;
	float magFactor=std::pow(0.6f , magDrop);
	magFactor=qMin(magFactor, 2.0f); // Limit excessively bright display.

	comaTexture->bind();
	sPainter->setColor(magFactor,magFactor,0.6f*magFactor);
	sPainter->setArrays((Vec3d*)comaVertexArr.constData(), (Vec2f*)comaTexCoordArr.constData());
	sPainter->drawFromArray(StelPainter::Triangles, comaVertexArr.size()/3);

	glDisable(GL_BLEND);

	if (sPainter)
		delete sPainter;
	sPainter=NULL;
}
开发者ID:huiqingz,项目名称:stellarium-to-oculus,代码行数:32,代码来源:Comet.cpp

示例4: drawLabel

void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
{
	float lim = mag;
	if (lim > 50) lim = 15.f;

	// temporary workaround of this bug: https://bugs.launchpad.net/stellarium/+bug/1115035 --AW
	if (getEnglishName().contains("Pleiades"))
		lim = 5.f;

	if (lim>maxMagLabel)
		return;

	Vec3f col(labelColor[0], labelColor[1], labelColor[2]);

	sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
	float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();
	float shift = 4.f + size/1.8f;
	QString str;
	if (!nameI18.isEmpty())
		str = getNameI18n();
	else
	{
		if (M_nb > 0)
			str = QString("M %1").arg(M_nb);
		else if (C_nb > 0)
			str = QString("C %1").arg(C_nb);
		else if (NGC_nb > 0)
			str = QString("NGC %1").arg(NGC_nb);
		else if (IC_nb > 0)
			str = QString("IC %1").arg(IC_nb);		
	}

	sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
}
开发者ID:incadoi,项目名称:stellarium,代码行数:34,代码来源:Nebula.cpp

示例5: drawName

void Constellation::drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const
{
	if (!nameFader.getInterstate())
		return;

	if (checkVisibility())
	{
		QString name;
		switch (style)
		{
			case ConstellationMgr::constellationsTranslated:
				name=nameI18;
				break;
			case ConstellationMgr::constellationsNative:
				name=nativeName;
				break;
			case ConstellationMgr::constellationsEnglish:
				name=englishName;
				break;
			case ConstellationMgr::constellationsAbbreviated:
				name=(abbreviation.startsWith('.') ? "" : abbreviation);
				break;
			Q_ASSERT(0);
		}

		sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], nameFader.getInterstate());
		sPainter.drawText(XYname[0], XYname[1], name, 0., -sPainter.getFontMetrics().width(name)/2, 0, false);
	}
}
开发者ID:NGCyang,项目名称:stellarium,代码行数:29,代码来源:Constellation.cpp

示例6: draw

void Galaxy::draw(StelCore* core, StelPainter& painter, float)
{
    StelSkyDrawer* sd = core->getSkyDrawer();

    Vec3f color = Vec3f(0.4f,0.5f,1.2f);
    if (StelApp::getInstance().getVisionModeNight())
        color = StelUtils::getNightColor(color);

    double mag = getVMagnitude(core, true);

    StelUtils::spheToRect(RA, DE, XYZ);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);
    glEnable(GL_TEXTURE_2D);
    painter.setColor(color[0], color[1], color[2], Galaxy::galaxyBrightness);
    glColor4f(color[0],color[1],color[2], Galaxy::galaxyBrightness);

    if (mag <= sd->getLimitMagnitude())
    {
        Galaxy::markerTexture->bind();

        float size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
        float shift = 5.f + size/1.6f;
            if (GETSTELMODULE(POGS)->getDisplayMode())
            {
                painter.drawSprite2dMode(XYZ, 6);
                painter.drawText(XYZ, " ", 0, shift, shift, false);
            }
            else
            {
                painter.drawSprite2dMode(XYZ, 6);
                painter.drawText(XYZ, designation, 0, shift, shift, false);
            }
    }
}
开发者ID:dcarrion87,项目名称:pogs-stel,代码行数:35,代码来源:Galaxy.cpp

示例7: draw

void Supernova::draw(StelCore* core, StelPainter& painter)
{
	StelSkyDrawer* sd = core->getSkyDrawer();

	Vec3f color = Vec3f(1.f,1.f,1.f);
	if (StelApp::getInstance().getVisionModeNight())
		color = StelUtils::getNightColor(color);

	float rcMag[2], size, shift;
	double mag;

	StelUtils::spheToRect(snra, snde, XYZ);
	mag = getVMagnitude(core, true);
	sd->preDrawPointSource(&painter);
	
	if (mag <= sd->getLimitMagnitude())
	{
		sd->computeRCMag(mag, rcMag);		
//		sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, color, false);
		sd->drawPointSource(&painter, XYZ, rcMag, color, false);
		painter.setColor(color[0], color[1], color[2], 1);
		size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
		shift = 6.f + size/1.8f;
		if (labelsFader.getInterstate()<=0.f)
		{
			painter.drawText(XYZ, designation, 0, shift, shift, false);
		}
	}

	sd->postDrawPointSource(&painter);
}
开发者ID:ammarshadiq,项目名称:stellarium-0.11.4,代码行数:31,代码来源:Supernova.cpp

示例8: drawPointer

void StarMgr::drawPointer(StelPainter& sPainter, const StelCore* core)
{
	const QList<StelObjectP> newSelected = objectMgr->getSelectedObject("Star");
	if (!newSelected.empty())
	{
		const StelObjectP obj = newSelected[0];
		Vec3d pos=obj->getJ2000EquatorialPos(core);

		Vec3d screenpos;
		// Compute 2D pos and return if outside screen
		if (!sPainter.getProjector()->project(pos, screenpos))
			return;

		Vec3f c(obj->getInfoColor());
		if (StelApp::getInstance().getVisionModeNight())
			c = StelUtils::getNightColor(c);

		sPainter.setColor(c[0], c[1], c[2]);
		texPointer->bind();
		sPainter.enableTexture2d(true);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
		sPainter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
	}
}
开发者ID:ammarshadiq,项目名称:stellarium-0.11.4,代码行数:25,代码来源:StarMgr.cpp

示例9: draw

bool ScreenLabel::draw(StelCore*, StelPainter& sPainter)
{
	if (labelFader.getInterstate() <= 0.0)
		return false;

	sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], labelFader.getInterstate());
	sPainter.setFont(labelFont);
	sPainter.drawText(screenX, screenY, labelText, 0, 0, 0, false);
	return true;
}
开发者ID:huiqingz,项目名称:stellarium-to-oculus,代码行数:10,代码来源:LabelMgr.cpp

示例10: drawOrbit

void TleTraj::drawOrbit(StelPainter &painter)
{
    StelVertexArray vertexArray(StelVertexArray::LineStrip);
    for (QList<Vec3d>::iterator it = trajectory.begin(); it != trajectory.end(); ++it)
    {
        vertexArray.vertex.append(*it);
    }
    painter.setColor(orbitColor->redF(), orbitColor->greenF(), orbitColor->blueF());
    painter.drawGreatCircleArcs(vertexArray, &viewportHalfspace);
}
开发者ID:areinull,项目名称:stell_plugin,代码行数:10,代码来源:TleTraj.cpp

示例11: drawArtOptim

void Constellation::drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const
{
	if (checkVisibility())
	{
		const float intensity = artFader.getInterstate();
		if (artTexture && intensity && region.intersects(boundingCap))
		{
			sPainter.setColor(intensity,intensity,intensity);

			// The texture is not fully loaded
			if (artTexture->bind()==false)
				return;

			sPainter.drawStelVertexArray(artPolygon);
		}
	}
}
开发者ID:NGCyang,项目名称:stellarium,代码行数:17,代码来源:Constellation.cpp

示例12: drawHints

void Nebula::drawHints(StelPainter& sPainter, float maxMagHints)
{
	float lim = mag;
	if (lim > 50) lim = 15.f;

	// temporary workaround of this bug: https://bugs.launchpad.net/stellarium/+bug/1115035 --AW
	if (getEnglishName().contains("Pleiades"))
		lim = 5.f;

	if (lim>maxMagHints)
		return;
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE, GL_ONE);
	float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8;
	Vec3f col(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness);

	sPainter.setColor(col[0], col[1], col[2], 1);
	switch (nType)
	{
		case NebGx:
			Nebula::texGalaxy->bind();
			break;
		case NebOc:
			Nebula::texOpenCluster->bind();
			break;
		case NebGc:
			Nebula::texGlobularCluster->bind();
			break;
		case NebN:
			Nebula::texDiffuseNebula->bind();
			break;
		case NebPn:
			Nebula::texPlanetaryNebula->bind();
			break;
		case NebCn:
			Nebula::texOpenClusterWithNebulosity->bind();
			break;
		default:
			Nebula::texCircle->bind();
	}

	sPainter.drawSprite2dMode(XY[0], XY[1], 6);
}
开发者ID:incadoi,项目名称:stellarium,代码行数:43,代码来源:Nebula.cpp

示例13: drawOptim

void Constellation::drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const
{
	if (lineFader.getInterstate()<=0.0001f)
		return;

	if (checkVisibility())
	{
		sPainter.setColor(lineColor[0], lineColor[1], lineColor[2], lineFader.getInterstate());

		Vec3d star1;
		Vec3d star2;
		for (unsigned int i=0;i<numberOfSegments;++i)
		{
			star1=asterism[2*i]->getJ2000EquatorialPos(core);
			star2=asterism[2*i+1]->getJ2000EquatorialPos(core);
			star1.normalize();
			star2.normalize();			
			sPainter.drawGreatCircleArc(star1, star2, &viewportHalfspace);			
		}
	}
}
开发者ID:NGCyang,项目名称:stellarium,代码行数:21,代码来源:Constellation.cpp

示例14: drawPointer

void Novae::drawPointer(StelCore* core, StelPainter &painter)
{
	const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)->getSelectedObject("Nova");
	if (!newSelected.empty())
	{
		const StelObjectP obj = newSelected[0];
		Vec3d pos=obj->getJ2000EquatorialPos(core);

		Vec3d screenpos;
		// Compute 2D pos and return if outside screen
		if (!painter.getProjector()->project(pos, screenpos))
			return;

		const Vec3f& c(obj->getInfoColor());
		painter.setColor(c[0],c[1],c[2]);
		texPointer->bind();
		painter.enableTexture2d(true);
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
		painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
	}
}
开发者ID:ikuya,项目名称:stellarium,代码行数:22,代码来源:Novae.cpp

示例15: drawPointer

void Pulsars::drawPointer(StelCore* core, StelPainter& painter)
{
	const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);

	const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)->getSelectedObject("Pulsar");
	if (!newSelected.empty())
	{
		const StelObjectP obj = newSelected[0];
		Vec3d pos=obj->getJ2000EquatorialPos(core);

		Vec3d screenpos;
		// Compute 2D pos and return if outside screen
		if (!painter.getProjector()->project(pos, screenpos))
			return;

		const Vec3f& c(obj->getInfoColor());
		painter.setColor(c[0],c[1],c[2]);
		texPointer->bind();
		painter.setBlending(true);
		painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, StelApp::getInstance().getTotalRunTime()*40.);
	}
}
开发者ID:Stellarium,项目名称:stellarium,代码行数:22,代码来源:Pulsars.cpp


注:本文中的StelPainter::setColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。