本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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
}
示例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;
}
}
示例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;
}
示例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());
}
示例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() );
}
示例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);
}
}
示例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;
}
示例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
}
示例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;
}
示例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;
}
}
}
示例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");
}