// static
BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
{
	LLImageGL* bump = NULL;

	U8 bump_code = params.mBump;
	LLViewerImage* tex = params.mTexture;

	switch( bump_code )
	{
	case BE_NO_BUMP:
		bump = NULL;
		break;
	case BE_BRIGHTNESS: 
	case BE_DARKNESS:
		if( tex )
		{
			if(tex->getID()== IMG_DEFAULT)
			{
				return TRUE;
			}

			bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
		}
		break;

	default:
		if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
		{
			bump = gStandardBumpmapList[bump_code].mImage;
			gBumpImageList.addTextureStats(bump_code, tex->getID(), params.mVSize);
		}
		break;
	}

	if (bump)
	{
		if (channel == -2)
		{
			gGL.getTexUnit(1)->bind(bump);
			gGL.getTexUnit(0)->bind(bump);
		}
		else
		{
			gGL.getTexUnit(channel)->bind(bump);
		}

		return TRUE;
	}
	
	return FALSE;
}
Exemple #2
0
//static
BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsize, S32 channel)
{
	//Note: texture atlas does not support bump texture now.
	LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(texture) ;
	if(!tex)
	{
		//if the texture is not a fetched texture
		return FALSE;
	}

	LLViewerTexture* bump = NULL;

	switch( bump_code )
	{
	case BE_NO_BUMP:		
		break;
	case BE_BRIGHTNESS: 
	case BE_DARKNESS:
		bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );		
		break;

	default:
		if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
		{
			bump = gStandardBumpmapList[bump_code].mImage;
			gBumpImageList.addTextureStats(bump_code, tex->getID(), vsize);
		}
		break;
	}

	if (bump)
	{
		if (channel == -2)
		{
			gGL.getTexUnit(1)->bind(bump);
			gGL.getTexUnit(0)->bind(bump);
		}
		else
		{
			gGL.getTexUnit(channel)->bind(bump);
		}

		return TRUE;
	}

	return FALSE;
}
Exemple #3
0
// static
BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params)
{
	LLImageGL* bump = NULL;

	U8 bump_code = params.mBump;
	LLViewerImage* tex = params.mTexture;

	switch( bump_code )
	{
	case BE_NO_BUMP:
		bump = NULL;
		break;
	case BE_BRIGHTNESS: 
	case BE_DARKNESS:
		if( tex )
		{
			bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code );
		}
		break;

	default:
		if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
		{
			bump = gStandardBumpmapList[bump_code].mImage;
			gBumpImageList.addTextureStats(bump_code, tex->getID(), params.mVSize, 1, 1);
		}
		break;
	}

	if (bump)
	{
		bump->bind(1);
		bump->bind(0);
		return TRUE;
	}
	return FALSE;
}