src/softbody2/FrameWork/DRGTexture.cpp
HRESULT CDRGTexture::LoadTextureImage()
{

	//
	// Load the Texture
	//
	if( m_pTextureLoader )
	{
		HBITMAP *pAlpha = NULL;
		if( !m_pAlphaTextureLoader )
			pAlpha = &hbmAlphaBitmap;
		if( FAILED( m_pTextureLoader->LoadImage( &hbmBitmap, pAlpha ) ) )
			return DDERR_NOTFOUND;
		if( hbmBitmap == NULL )
			return DDERR_NOTFOUND;
		if( hbmAlphaBitmap )
			bHasAlpha = TRUE;
	}
	
	if( bHasAlpha && m_pAlphaTextureLoader && !hbmAlphaBitmap )
	{
		if( FAILED( m_pAlphaTextureLoader->LoadImage( &hbmAlphaBitmap, NULL ) ) )
			return DDERR_NOTFOUND;
		if( hbmAlphaBitmap == NULL )
			return DDERR_NOTFOUND;
	}

	//last sanity check.
	if (hbmBitmap)
	{
		if (bHasAlpha)
		{
			if (hbmAlphaBitmap)
				return DD_OK; // alpha and bitmap found
			else
			{
				//
				// Free the loaded Bitmap
				//
				DeleteObject( hbmBitmap );
				hbmBitmap = NULL;
				return DDERR_NOTFOUND; //asked for alpha, but alpha not found
			}
		}
		else
			return DD_OK; //no alpha, bitmap found
	}
	else if( hbmAlphaBitmap )
	{
		DeleteObject( hbmAlphaBitmap );
		hbmAlphaBitmap = NULL;
	}

	return DDERR_NOTFOUND; //bitmap couldn't load
}
//-----------------------------------------------------------------------------
// Name: LoadTextureImage()
// Desc: Loads a texture map file (or resource) into a BITMAP surface.
//-----------------------------------------------------------------------------
LoadTextureImage()
Desc: Loads a texture map file (or resource) into a BITMAP surface.
LoadTextureImage () Desc : Loads a texture map file ( or resource ) into a BITMAP surface .
HRESULT CDRGTexture::LoadTextureImage()
{
	 Load the Texture
	if( m_pTextureLoader )
	{
		HBITMAP *pAlpha = NULL;
		if( !m_pAlphaTextureLoader )
			pAlpha = &hbmAlphaBitmap;
		if( FAILED( m_pTextureLoader->LoadImage( &hbmBitmap, pAlpha ) ) )
			return DDERR_NOTFOUND;
		if( hbmBitmap == NULL )
			return DDERR_NOTFOUND;
		if( hbmAlphaBitmap )
			bHasAlpha = TRUE;
	}
	if( bHasAlpha && m_pAlphaTextureLoader && !hbmAlphaBitmap )
	{
		if( FAILED( m_pAlphaTextureLoader->LoadImage( &hbmAlphaBitmap, NULL ) ) )
			return DDERR_NOTFOUND;
		if( hbmAlphaBitmap == NULL )
			return DDERR_NOTFOUND;
	}
	last sanity check.
	if (hbmBitmap)
	{
		if (bHasAlpha)
		{
			if (hbmAlphaBitmap)
				return DD_OK;  alpha and bitmap found
			else
			{
				 Free the loaded Bitmap
				DeleteObject( hbmBitmap );
				hbmBitmap = NULL;
				return DDERR_NOTFOUND; asked for alpha, but alpha not found
			}
		}
		else
			return DD_OK; no alpha, bitmap found
	}
	else if( hbmAlphaBitmap )
	{
		DeleteObject( hbmAlphaBitmap );
		hbmAlphaBitmap = NULL;
	}
	return DDERR_NOTFOUND; bitmap couldn't load
}
HRESULT CDRGTexture :: LoadTextureImage ( ) { if ( m_pTextureLoader ) { HBITMAP * pAlpha = NULL ; if ( ! m_pAlphaTextureLoader ) pAlpha = & hbmAlphaBitmap ; if ( FAILED ( m_pTextureLoader -> LoadImage ( & hbmBitmap , pAlpha ) ) ) return DDERR_NOTFOUND ; if ( hbmBitmap == NULL ) return DDERR_NOTFOUND ; if ( hbmAlphaBitmap ) bHasAlpha = TRUE ; } if ( bHasAlpha && m_pAlphaTextureLoader && ! hbmAlphaBitmap ) { if ( FAILED ( m_pAlphaTextureLoader -> LoadImage ( & hbmAlphaBitmap , NULL ) ) ) return DDERR_NOTFOUND ; if ( hbmAlphaBitmap == NULL ) return DDERR_NOTFOUND ; } if ( hbmBitmap ) { if ( bHasAlpha ) { if ( hbmAlphaBitmap ) return DD_OK ; else { DeleteObject ( hbmBitmap ) ; hbmBitmap = NULL ; return DDERR_NOTFOUND ; } } else return DD_OK ; } else if ( hbmAlphaBitmap ) { DeleteObject ( hbmAlphaBitmap ) ; hbmAlphaBitmap = NULL ; } return DDERR_NOTFOUND ; }
Name: LoadTextureImage()
Desc: Loads a texture map file (or resource) into a BITMAP surface.
Name : LoadTextureImage () Desc : Loads a texture map file ( or resource ) into a BITMAP surface .
// // Load the Texture // //last sanity check. // alpha and bitmap found // // Free the loaded Bitmap // //asked for alpha, but alpha not found //no alpha, bitmap found //bitmap couldn't load