Esempio n. 1
0
// static
void FormatConversion::image3ubToImage4f( const Image3ub& source, Image4f& destination, bool flipUpDown, float fillAlpha )
{
	int width = source.width();
	int height = source.height();

	for( int y = 0; y < height; ++y )
	{
		int yy = y;
		if( flipUpDown )
		{
			yy = height - y - 1;
		}

		for( int x = 0; x < width; ++x )
		{
			Vector3i input = source.pixel( x, y );
			Vector3f output = ColorUtils::intToFloat( input );			
			destination.setPixel( x, yy, Vector4f( output, fillAlpha ) );
		}
	}
}
Esempio n. 2
0
// static
void FormatConversion::image4fToImage3ub( const Image4f& source, Image3ub& destination, bool flipUpDown )
{
	int width = source.width();
	int height = source.height();

	for( int y = 0; y < height; ++y )
	{
		int yy = y;
		if( flipUpDown )
		{
			yy = height - y - 1;
		}

		for( int x = 0; x < width; ++x )
		{
			Vector4f input = source.pixel( x, y );
			Vector3i output = ColorUtils::floatToInt( input ).xyz();
			destination.setPixel( x, yy, output );
		}
	}
}
Esempio n. 3
0
void Texture2::Load(const Image3ub& img, bool linear, bool mipmaps)
{
	Load(img.width(), img.height(), img.data(), linear, mipmaps);
}