コード例 #1
0
ファイル: conversion.cpp プロジェクト: Paulus/irrlichtnetcp
void UM_SCOLOR(irr::video::SColor color, M_SCOLOR t)
{
    t[0] = color.getAlpha();
    t[1] = color.getRed();
    t[2] = color.getGreen();
    t[3] = color.getBlue();
}
コード例 #2
0
ファイル: testUtils.cpp プロジェクト: vgck/irrnacht
void stabilizeScreenBackground(irr::video::IVideoDriver * driver,
		irr::video::SColor color)
{
	for(int i = 0; i < 10000; ++i) 
	{
		driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, color);
		driver->endScene();

		irr::video::IImage * screenshot = driver->createScreenShot();
		if (!screenshot)
			return;

		const video::ECOLOR_FORMAT format = screenshot->getColorFormat();
		if (format != video::ECF_R8G8B8)
		{
			irr::video::IImage * fixedScreenshot = driver->createImage(video::ECF_R8G8B8, screenshot->getDimension());
			screenshot->copyTo(fixedScreenshot);
			screenshot->drop();

			if (!fixedScreenshot)
				return;

			screenshot = fixedScreenshot;
		}

		u8 * image1Data = (u8*)screenshot->getData();

		const u32 pixels = (screenshot->getPitch() * screenshot->getDimension().Height) / 4;
		bool status = true;
		for(u32 pixel = 0; pixel < pixels; ++pixel)
		{
			const u8 r = *(image1Data++);
			const u8 g = *(image1Data++);
			const u8 b = *(image1Data++);

			if (r != color.getRed() || g != color.getGreen() || b != color.getBlue())
			{
				status = false;
				break;
			}
		}

		if (status)
		{
			screenshot->drop();
			return;
		}
		screenshot->drop();
	}
	
	logTestString("stabilizeScreenBackground failed\n");
}
コード例 #3
0
 static void setUniformsHelper(const std::vector<GLuint> &uniforms, const irr::video::SColor &col, Args... arg)
 {
     glUniform4i(uniforms[N], col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
     setUniformsHelper<N + 1>(uniforms, arg...);
 }
コード例 #4
0
 static std::string format(const irr::video::SColor& obj) {
     std::ostringstream ss;
     ss << "col(" << obj.getRed() << ", " << obj.getGreen() << ", " << obj.getBlue() << ", " << obj.getAlpha()
         << ")";
     return ss.str();
 }