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


C++ SColor类代码示例

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


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

示例1: renderFog

void PostProcessing::renderFog()
{
    const Track * const track = World::getWorld()->getTrack();

    // This function is only called once per frame - thus no need for setters.
    const float fogmax = track->getFogMax();
    const float startH = track->getFogStartHeight();
    const float endH = track->getFogEndHeight();
    const float start = track->getFogStart();
    const float end = track->getFogEnd();
    const SColor tmpcol = track->getFogColor();

    core::vector3df col( tmpcol.getRed() / 255.0f,
        tmpcol.getGreen() / 255.0f,
        tmpcol.getBlue() / 255.0f );

    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendEquation(GL_FUNC_ADD);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glUseProgram(FullScreenShader::FogShader::Program);
    glBindVertexArray(FullScreenShader::FogShader::vao);

    setTexture(0, irr_driver->getDepthStencilTexture(), GL_NEAREST, GL_NEAREST);
    FullScreenShader::FogShader::setUniforms(fogmax, startH, endH, start, end, col, 0);

    glDrawArrays(GL_TRIANGLES, 0, 3);
    glBindVertexArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    glEnable(GL_DEPTH_TEST);
    glDisable(GL_BLEND);
}
开发者ID:krishnabm,项目名称:stk-code,代码行数:34,代码来源:post_processing.cpp

示例2: renderFog

void PostProcessing::renderFog()
{
    const Track * const track = World::getWorld()->getTrack();

    // This function is only called once per frame - thus no need for setters.
    const float fogmax = track->getFogMax();
    const float startH = track->getFogStartHeight();
    const float endH = track->getFogEndHeight();
    const float start = track->getFogStart();
    const float end = track->getFogEnd();
    const SColor tmpcol = track->getFogColor();

    core::vector3df col( tmpcol.getRed() / 255.0f,
        tmpcol.getGreen() / 255.0f,
        tmpcol.getBlue() / 255.0f );

    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendEquation(GL_FUNC_ADD);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


    FullScreenShader::FogShader::getInstance()->SetTextureUnits(createVector<GLuint>(irr_driver->getDepthStencilTexture()));
    DrawFullScreenEffect<FullScreenShader::FogShader>(fogmax, startH, endH, start, end, col);

    glEnable(GL_DEPTH_TEST);
    glDisable(GL_BLEND);
}
开发者ID:ChristophHaag,项目名称:stk-code,代码行数:28,代码来源:post_processing.cpp

示例3: createRainbowImage

IImage* createRainbowImage( u32 w, u32 h, u8 transparency, f64 gamma)
{
	// create image
	core::dimension2du size(w,h);

	IImage* img = (IImage*)new CImage(ECF_A8R8G8B8, size);

	if (!img) return 0;

	size = img->getDimension();

	// loop pixels per col
	for (u32 y=0; y<size.Height; y++)
	{
		// calculate rainbow-color
		SColor c = createRainbowColor( y, size.Height, gamma);

		// set transparency
		c.setAlpha(transparency);

		// write one row with same color
		for (u32 x=0; x<size.Width; x++)
		{
			// write rainbow-color
			img->setPixel(x,y,c,false);
		}
	}

	return img;
}
开发者ID:benjaminhampe,项目名称:libHampe,代码行数:30,代码来源:createRainbow.cpp

示例4: CHudProgressBar

void CMenuLogin::updateHuds()
{
	_gerHud->clear();

	if(_loadingStage == LS_PERSONAGENS) 
	{
		_gameCore->_barraLoad = new CHudProgressBar(_gerHud->getRootGUIElement(), _gerHud, rect<s32>( 0+100, _gameCore->sHeight-200, _gameCore->sWidth-100, _gameCore->sHeight-100));
		_gameCore->_barraLoad->setProgress(0.00001f);
	}

	if(_loadingStage > LS_COUNT)
	{
		IGUIImage *img =_gerHud->addImage(_gerVideo->getTexture("recursos/huds/bg_login.png"), position2d<s32>(/*112, 84*/0,0));

		Login = _gerHud->addEditBox(L"fantini", rect<s32>(400,700,500,720), true, 0, 10);
		Password = _gerHud->addEditBox(L"wurzelion", rect<s32>(400,730,500,750), true, 0, 20);
		Password->setPasswordBox(true);
		Login->setMax(15);
		Password->setMax(15);

		_gerHud->addButton(rect<s32>(520,700,620,750), 0, 101, L"conectar");
		//IGUIButton *connect;
		//addNewBtn(connect, rect<s32>(550,700,602,752), 0, 101, 0, L"conectar", true, false, H_CONECTAR, H_CONECTAR);
	}

	for (u32 i=0; i<EGDC_COUNT ; ++i)
	{
		SColor col = _gerHud->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
		col.setAlpha(255);
		_gerHud->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
	}

	_menuFlag[HUDUPDATED] = true;
}
开发者ID:phabh,项目名称:warbugs,代码行数:34,代码来源:CMenuLogin.cpp

示例5: RasterizePixel

	void RasGouraud::RasterizePixel( SScanLine& scanLine, const SScanLinesData& rasData )
	{
#if USE_PERSPEC_CORRECT == 1
		//双曲插值最后一步
		float inv_w = 1 / scanLine.zw.y;
		scanLine.pixelColor.Set(scanLine.curClr.x*inv_w, scanLine.curClr.y*inv_w, scanLine.curClr.z*inv_w);
#else
		scanLine.pixelColor = scanLine.curClr;
#endif

		scanLine.pixelColor.Saturate();

		DWORD& dwDestColor = *scanLine.pFragmeng->finalColor;

#if USE_OIT == 0
		SColor destPixelColor;
		destPixelColor.SetAsInt(dwDestColor);

		DoAlphaBlending(destPixelColor, scanLine.pixelColor, destPixelColor, rasData.pMaterial);

		dwDestColor = destPixelColor.GetAsInt();
#else
		scanLine.pixelColor.a *= rasData.pMaterial->transparency;
		dwDestColor = scanLine.pixelColor.GetAsInt();
#endif

#if USE_PROFILER == 1
		g_env.profiler->AddRenderedPixel();
#endif
	}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:30,代码来源:Rasterizer_Gouraud.cpp

示例6: setPixel

//! sets a pixel
void SImage::setPixel(u32 x, u32 y, const SColor &color )
{
	if (x >= (u32)Size.Width || y >= (u32)Size.Height)
		return;

	switch(Format)
	{
		case ECF_A1R5G5B5:
		{
			u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
			*dest = video::A8R8G8B8toA1R5G5B5 ( color.color );
		} break;

		case ECF_R5G6B5:
		{
			u16 * dest = (u16*) ((u8*) Data + ( y * Pitch ) + ( x << 1 ));
			*dest = video::A8R8G8B8toR5G6B5 ( color.color );
		} break;

		case ECF_R8G8B8:
		{
			u8* dest = (u8*) Data + ( y * Pitch ) + ( x * 3 );
			dest[0] = color.getRed();
			dest[1] = color.getGreen();
			dest[2] = color.getBlue();
		} break;

		case ECF_A8R8G8B8:
		{
			u32 * dest = (u32*) ((u8*) Data + ( y * Pitch ) + ( x << 2 ));
			*dest = color.color;
		} break;
	}
}
开发者ID:AwkwardDev,项目名称:pseuwow,代码行数:35,代码来源:SImage.cpp

示例7:

		//! Constructs a color from 32 bit Color.
		SColorf::SColorf(SColor c)
		{
			const f32 inv = 1.0f / 255.0f;
			Red = c.getRed() * inv;
			Green = c.getGreen() * inv;
			Blue = c.getBlue() * inv;
			Alpha = c.getAlpha() * inv;
		}
开发者ID:CowPlay,项目名称:engineSDK,代码行数:9,代码来源:SColorf.cpp

示例8: fill

		//! fills the surface with given color
		void CImage::fill(const SColor &color)
		{
			u32 c;

			switch (Format)
			{
				case ECF_A1R5G5B5:
				{
					c = color.toA1R5G5B5();
					c |= c << 16;
					break;
				}
				case ECF_R5G6B5:
				{
					c = SharedColorConverter::getInstance().A8R8G8B8toR5G6B5(
							color.color);
					c |= c << 16;
					break;
				}
				case ECF_A8R8G8B8:
				{
					c = color.color;
					break;
				}
				case ECF_R8G8B8:
				{
					u8 rgb[3];
					SharedColorConverter::getInstance().convert_A8R8G8B8toR8G8B8(
							&color, 1, rgb);
					const u32 size = getImageDataSizeInBytes();
					for (u32 i = 0; i < size; i += 3)
					{
						memcpy(Data + i, rgb, 3);
					}
					return;

					break;
				}

				case ECF_R16F:
				case ECF_G16R16F:
				case ECF_A16B16G16R16F:
				case ECF_R32F:
				case ECF_G32R32F:
				case ECF_A32B32G32R32F:
				case ECF_UNKNOWN:
				default:
				{
					break;
				}
			}

			if (Format != ECF_A1R5G5B5 && Format != ECF_R5G6B5
					&& Format != ECF_A8R8G8B8)
			{
				return;
			}

			StaticVideoUtils::memset32(Data, c, getImageDataSizeInBytes());
		}
开发者ID:CowPlay,项目名称:engineSDK,代码行数:61,代码来源:CImage.cpp

示例9: fill

//! fills the surface with given color
void CImage::fill(const SColor &color)
{
	u32 c;

	switch ( Format )
	{
		case ECF_A1R5G5B5:
			c = color.toA1R5G5B5();
			c |= c << 16;
			break;
		case ECF_R5G6B5:
			c = video::A8R8G8B8toR5G6B5( color.color );
			c |= c << 16;
			break;
		case ECF_A8R8G8B8:
			c = color.color;
			break;
		case ECF_R8G8B8:
		{
			u8 rgb[3];
			CColorConverter::convert_A8R8G8B8toR8G8B8(&color, 1, rgb);
			const u32 size = getImageDataSizeInBytes();
			for (u32 i=0; i<size; i+=3)
			{
				memcpy(Data+i, rgb, 3);
			}
			return;
		}
		break;
		default:
		// TODO: Handle other formats
			return;
	}
	memset32( Data, c, getImageDataSizeInBytes() );
}
开发者ID:nguyenkim495,项目名称:KidBuu,代码行数:36,代码来源:CImage.cpp

示例10: OnSimulationZAxisGetColorFunctionPointer

void WxIrrMainWindow::OnSimulationShowZAxisChangeColor(wxCommandEvent &event)
{
    wxColourData colorData;
    SColor currentIrrColor = OnSimulationZAxisGetColorFunctionPointer();
    wxColour currentWxColor(currentIrrColor.getRed(), currentIrrColor.getGreen(), currentIrrColor.getBlue());
    colorData.SetColour(currentWxColor);

    wxColourDialog colorDiag(this, &colorData);

    if (colorDiag.ShowModal() == wxID_OK)
    {
        wxColourData retData = colorDiag.GetColourData();
        wxColour col = retData.GetColour();

        OnSimulationZAxisChangeColorFunctionPointer(col);
    }
}
开发者ID:niraj-rayalla,项目名称:PhysicsHelper,代码行数:17,代码来源:WxIrrMainWindow.cpp

示例11: computeRay

RayBuffer RayTracer::traceRays() {
    // #pragma omp parallel for
    for (uint y = 0; y < HEIGHT; y++) {
        // #pragma omp parallel for
        for (uint x = 0; x < WIDTH; x++) {
            Ray r = computeRay(x, y);
            Intersection in = scene->calculateRayIntersection(r);
            SColor c = shadeIntersection(in, depth);
            PX_Color color;
            color.R = (uint8_t) (255 * c.R());
            color.G = (uint8_t) (255 * c.G());
            color.B = (uint8_t) (255 * c.B());
            buffer.setPixel(x, y, color);
        }
    }
    return buffer;
}
开发者ID:sondrele,项目名称:NTNU,代码行数:17,代码来源:raytracer.cpp

示例12: texColor

	void RasNormalMap::FragmentPS( SFragment& frag )
	{
		SColor texColor(SColor::WHITE), lightColor(SColor::WHITE);
		SMaterial* pMaterial = frag.pMaterial;

		if(pMaterial->pDiffuseMap && pMaterial->bUseBilinearSampler)
		{
			pMaterial->pDiffuseMap->Tex2D_Bilinear(frag.uv, texColor, frag.texLod);
		}
		else if(pMaterial->pDiffuseMap)
		{
			pMaterial->pDiffuseMap->Tex2D_Point(frag.uv, texColor, frag.texLod);
		}

		SLightingContext_NormalMap lc;
		lc.uv = &frag.uv;
		lc.lightDirTS = &frag.lightDirTS;
		lc.hVectorTS = &frag.hVectorTS;

		DoPerPixelLighting(lightColor, &lc, pMaterial);

		// Don't modify alpha [1/19/2014 mavaL]
		float alpha = texColor.a;

		texColor *= lightColor;
		texColor.a = alpha;
		texColor.Saturate();

		DWORD& dwDestColor = *frag.finalColor;

#if USE_OIT == 0
		SColor destPixelColor;
		destPixelColor.SetAsInt(dwDestColor);

		DoAlphaBlending(destPixelColor, texColor, destPixelColor, pMaterial);

		dwDestColor = destPixelColor.GetAsInt();
#else
		texColor.a *= pMaterial->transparency;
		dwDestColor = texColor.GetAsInt();
#endif

#if USE_PROFILER == 1
		g_env.profiler->AddRenderedPixel();
#endif
	}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:46,代码来源:Rasterizer_NormalMap.cpp

示例13: mult

SColor SColor::mult(SColor other) {
    SColor c;
    c.R(R() * other.R());
    c.G(G() * other.G());
    c.B(B() * other.B());
    return c;
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:rayscene_shapes.cpp

示例14: A1R5G5B5toA8R8G8B8

void CD3D9Texture::copy16BitMipMap(char* src, char* tgt,
				   s32 width, s32 height,
				   s32 pitchsrc, s32 pitchtgt) const
{
	for (s32 y=0; y<height; ++y)
	{
		for (s32 x=0; x<width; ++x)
		{
			u32 a=0, r=0, g=0, b=0;

			for (s32 dy=0; dy<2; ++dy)
			{
				const s32 tgy = (y*2)+dy;
				for (s32 dx=0; dx<2; ++dx)
				{
					const s32 tgx = (x*2)+dx;

					SColor c;
					if (ColorFormat == ECF_A1R5G5B5)
						c = A1R5G5B5toA8R8G8B8(*(u16*)(&src[(tgx*2)+(tgy*pitchsrc)]));
					else
						c = R5G6B5toA8R8G8B8(*(u16*)(&src[(tgx*2)+(tgy*pitchsrc)]));

					a += c.getAlpha();
					r += c.getRed();
					g += c.getGreen();
					b += c.getBlue();
				}
			}

			a /= 4;
			r /= 4;
			g /= 4;
			b /= 4;

			u16 c;
			if (ColorFormat == ECF_A1R5G5B5)
				c = RGBA16(r,g,b,a);
			else
				c = A8R8G8B8toR5G6B5(SColor(a,r,g,b).color);
			*(u16*)(&tgt[(x*2)+(y*pitchtgt)]) = c;
		}
	}
}
开发者ID:Lumirion,项目名称:pseuwow,代码行数:44,代码来源:CD3D9Texture.cpp

示例15: showExitConfirmDialog

void EventReceiver::showExitConfirmDialog(){
	IGUIEnvironment* env = device->getGUIEnvironment();
	IGUIWindow* window = env->addWindow(
		rect<s32>(224, 200, 800, 390),true, L"Confirm dialog");
	env->addStaticText(L"Do you want to exit the game?",
		rect<s32>(35,50,600,150),
		false, // border?
		false, // wordwrap?
		window);
	for (u32 i=0; i<EGDC_COUNT ; ++i){
		SColor col = env->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
		col.setAlpha(255);
		env->getSkin()->setColor((EGUI_DEFAULT_COLOR)i, col);
	}
	env->addButton(
		rect<s32>(15, 100, 285, 170), window, EXIT_OK, L"Ok");
	env->addButton(
		rect<s32>(300, 100, 555, 170), window, EXIT_CANCEL, L"Cancel");
}
开发者ID:DenisPanchenko,项目名称:Kaniv,代码行数:19,代码来源:EventReceiver.cpp


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