Пример #1
0
ComTexture operator-( float t , const Texture& tex )
{
	if( tex.m_iTexWidth == 0 || tex.m_iTexHeight == 0 )
		LOG_ERROR<<"One dimension of the image is zero , can't multiply."<<CRASH;

	//allocate the data
	Spectrum* data = new Spectrum[ tex.m_iTexWidth * tex.m_iTexHeight ];

	for( unsigned i = 0 ; i < tex.m_iTexHeight; i++ )
		for( unsigned j = 0 ; j < tex.m_iTexWidth ; j++ )
		{
			unsigned offset = i * tex.m_iTexWidth + j;
			data[offset] = t - tex.GetColor( (int)j , (int)i );
		}

	return ComTexture( data , tex.m_iTexWidth , tex.m_iTexHeight );
}
Пример #2
0
// the operator
ComTexture Texture::operator * ( const Texture& tex ) const
{
	if( tex.GetWidth() != m_iTexWidth || tex.GetHeight() != m_iTexHeight )
		LOG_ERROR<<"Size of the images are not the same , can't multiply."<<CRASH;

	if( m_iTexWidth == 0 || m_iTexHeight == 0 )
		LOG_ERROR<<"One dimension of the image is zero , can't multiply."<<CRASH;

	//allocate the data
	Spectrum* data = new Spectrum[ m_iTexWidth * m_iTexHeight ];

	for( unsigned i = 0 ; i < m_iTexHeight; i++ )
		for( unsigned j = 0 ; j < m_iTexWidth ; j++ )
		{
			unsigned offset = i * m_iTexWidth + j;
			data[offset] = tex.GetColor( (int)j , (int)i ) * GetColor( (int)j , (int)i );
		}

	return ComTexture( data , m_iTexWidth , m_iTexHeight );
}