diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index b9a42aa2ed..809617d70b 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -1009,7 +1009,7 @@ void BGAnimationLayer::Draw() 0, RageColor(0.6f,0.6f,0.6f,1), RageColor(0.9f,0.9f,0.9f,1), - RageColor(0,0,0,1), + RageColor(0.1f,0.1f,0.1f,1), RageVector3(0, 0, 1) ); } diff --git a/stepmania/src/BannerCache.cpp b/stepmania/src/BannerCache.cpp index 5e0ebafca4..10eddf74b3 100644 --- a/stepmania/src/BannerCache.cpp +++ b/stepmania/src/BannerCache.cpp @@ -184,7 +184,7 @@ struct BannerTexture: public RageTexture ASSERT( DISPLAY->SupportsTextureFormat(pf) ); ASSERT(img); - m_uTexHandle = DISPLAY->CreateTexture( pf, img ); + m_uTexHandle = DISPLAY->CreateTexture( pf, img, false ); CreateFrameRects(); } diff --git a/stepmania/src/ModelTypes.cpp b/stepmania/src/ModelTypes.cpp index f72d4a5124..9b10547da3 100644 --- a/stepmania/src/ModelTypes.cpp +++ b/stepmania/src/ModelTypes.cpp @@ -55,6 +55,7 @@ void AnimatedTexture::Load( CString sTexOrIniPath ) ID.filename = Dirname(sTexOrIniPath) + sFileName; ID.bStretch = true; ID.bHotPinkColorKey = true; + ID.bMipMaps = true; // use mipmaps in Models AnimatedTextureState state = { TEXTUREMAN->LoadTexture( ID ), fDelay @@ -71,6 +72,7 @@ void AnimatedTexture::Load( CString sTexOrIniPath ) ID.filename = sTexOrIniPath; ID.bHotPinkColorKey = true; ID.bStretch = true; + ID.bMipMaps = true; // use mipmaps in Models AnimatedTextureState state = { TEXTUREMAN->LoadTexture( ID ), 10 diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index fc6fbd90a3..6728c43db8 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -306,7 +306,7 @@ apply_color_key: ConvertSDLSurface(img, m_iTextureWidth, m_iTextureHeight, pfd->bpp, pfd->masks[0], pfd->masks[1], pfd->masks[2], pfd->masks[3]); - m_uTexHandle = DISPLAY->CreateTexture( pixfmt, img ); + m_uTexHandle = DISPLAY->CreateTexture( pixfmt, img, actualID.bMipMaps ); CreateFrameRects(); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index cd09fd5ada..0a97c8670b 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -151,7 +151,8 @@ public: * (unsigned in OpenGL, texture pointer in D3D) */ virtual unsigned CreateTexture( PixelFormat pixfmt, // format of img and of texture in video mem - SDL_Surface* img // must be in pixfmt + SDL_Surface* img, // must be in pixfmt + bool bGenerateMipMaps ) = 0; virtual void UpdateTexture( unsigned uTexHandle, diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 4a74cce05a..1f2a010d45 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -1053,7 +1053,8 @@ void RageDisplay_D3D::DeleteTexture( unsigned uTexHandle ) unsigned RageDisplay_D3D::CreateTexture( PixelFormat pixfmt, - SDL_Surface* img ) + SDL_Surface* img, + bool bGenerateMipMaps ) { // texture must be power of two ASSERT( img->w == power_of_two(img->w) ); diff --git a/stepmania/src/RageDisplay_D3D.h b/stepmania/src/RageDisplay_D3D.h index 85a8803cd9..98e18f7507 100644 --- a/stepmania/src/RageDisplay_D3D.h +++ b/stepmania/src/RageDisplay_D3D.h @@ -32,7 +32,10 @@ public: VideoModeParams GetVideoModeParams() const; void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ); - unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img ); + unsigned CreateTexture( + PixelFormat pixfmt, + SDL_Surface* img, + bool bGenerateMipMaps ); void UpdateTexture( unsigned uTexHandle, SDL_Surface* img, diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 2950b1c63b..ad01c39292 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -73,6 +73,7 @@ namespace GLExt { #ifdef WIN32 #pragma comment(lib, "opengl32.lib") +#pragma comment(lib, "glu32.lib") #endif // @@ -1238,7 +1239,8 @@ RageDisplay::PixelFormat RageDisplay_OGL::GetImgPixelFormat( SDL_Surface* &img, unsigned RageDisplay_OGL::CreateTexture( PixelFormat pixfmt, - SDL_Surface* img ) + SDL_Surface* img, + bool bGenerateMipMaps ) { ASSERT( pixfmt < NUM_PIX_FORMATS ); @@ -1248,7 +1250,7 @@ unsigned RageDisplay_OGL::CreateTexture( glBindTexture( GL_TEXTURE_2D, uTexHandle ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, bGenerateMipMaps ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR); SetTextureWrapping( false ); // texture must be power of two @@ -1304,9 +1306,24 @@ unsigned RageDisplay_OGL::CreateTexture( FlushGLErrors(); - glTexImage2D(GL_TEXTURE_2D, 0, glTexFormat, + // YUCK! There's no way to tell gluBuild2DMipmaps how many mip-map levels + // to make. It's all or nothing, so we have to call either glTexImage2D + // or gluBuild2DMipmaps + if( bGenerateMipMaps ) + { + gluBuild2DMipmaps( + GL_TEXTURE_2D, glTexFormat, + img->w, img->h, + glImageFormat, glImageType, img->pixels ); + } + else + { + glTexImage2D( + GL_TEXTURE_2D, 0, glTexFormat, img->w, img->h, 0, glImageFormat, glImageType, img->pixels); + } + GLenum error = glGetError(); if( error != GL_NO_ERROR ) diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index 5754cd1914..fd471275b6 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -18,7 +18,10 @@ public: void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ); bool Supports4BitPalettes(); - unsigned CreateTexture( PixelFormat pixfmt, SDL_Surface* img ); + unsigned CreateTexture( + PixelFormat pixfmt, + SDL_Surface* img, + bool bGenerateMipMaps ); void UpdateTexture( unsigned uTexHandle, SDL_Surface* img, diff --git a/stepmania/src/RageTextureID.cpp b/stepmania/src/RageTextureID.cpp index e79f352097..8ac3aa5908 100644 --- a/stepmania/src/RageTextureID.cpp +++ b/stepmania/src/RageTextureID.cpp @@ -3,40 +3,14 @@ void RageTextureID::Init() { - /* Maximum size of the texture, per dimension. */ iMaxSize = 2048; - - /* Number of mipmaps. (unimplemented) */ - iMipMaps = 4; - - /* Maximum number of bits for alpha. In 16-bit modes, lowering - * this gives more bits for color values. (0, 1 or 4) */ + bMipMaps = false; // Most sprites (especially text) look worse with mip maps iAlphaBits = 4; - - /* If this is greater than -1, then the image will be loaded as a luma/alpha - * map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens - * when paletted textures are supported. - * - * If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit - * palettes, then the image will be loaded with 4bpp. - * - * This may be set to 0, resulting in an alpha map with all pixels white. */ iGrayscaleBits = -1; - - /* If true and color precision is being lost, dither. (slow) */ bDither = false; - /* If true, resize the image to fill the internal texture. (slow) */ bStretch = false; - - /* Preferred color depth of the image. (This is overridden for - * paletted images and transparencies.) */ iColorDepth = -1; /* default */ - - /* If true, enable HOT PINK color keying. (deprecated but needed for - * banners) */ bHotPinkColorKey = false; - - /* These hints will be used in addition to any in the filename. */ AdditionalTextureHints = ""; } @@ -45,7 +19,7 @@ bool RageTextureID::operator<(const RageTextureID &rhs) const #define COMP(a) if(arhs.a) return false; COMP(filename); COMP(iMaxSize); - COMP(iMipMaps); + COMP(bMipMaps); COMP(iAlphaBits); COMP(iGrayscaleBits); COMP(iColorDepth); @@ -63,7 +37,7 @@ bool RageTextureID::operator==(const RageTextureID &rhs) const return EQUAL(filename) && EQUAL(iMaxSize) && - EQUAL(iMipMaps) && + EQUAL(bMipMaps) && EQUAL(iAlphaBits) && EQUAL(iGrayscaleBits) && EQUAL(iColorDepth) && diff --git a/stepmania/src/RageTextureID.h b/stepmania/src/RageTextureID.h index a4c5f03370..c362200ac7 100644 --- a/stepmania/src/RageTextureID.h +++ b/stepmania/src/RageTextureID.h @@ -8,14 +8,42 @@ struct RageTextureID { CString filename; + + /* Maximum size of the texture, per dimension. */ int iMaxSize; - int iMipMaps; + + /* Generate mipmaps for this texture */ + bool bMipMaps; + + /* Maximum number of bits for alpha. In 16-bit modes, lowering + * this gives more bits for color values. (0, 1 or 4) */ int iAlphaBits; + + /* If this is greater than -1, then the image will be loaded as a luma/alpha + * map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens + * when paletted textures are supported. + * + * If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit + * palettes, then the image will be loaded with 4bpp. + * + * This may be set to 0, resulting in an alpha map with all pixels white. */ int iGrayscaleBits; + + /* Preferred color depth of the image. (This is overridden for + * paletted images and transparencies.) -1 for default. */ int iColorDepth; + + /* If true and color precision is being lost, dither. (slow) */ bool bDither; + + /* If true, resize the image to fill the internal texture. (slow) */ bool bStretch; + + /* If true, enable HOT PINK color keying. (deprecated but needed for + * banners) */ bool bHotPinkColorKey; /* #FF00FF */ + + /* These hints will be used in addition to any in the filename. */ CString AdditionalTextureHints; bool operator< (const RageTextureID &rhs) const; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index ce7ef38b2a..10bc043664 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -521,6 +521,20 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S } } + for( p=0; pIsPlayerEnabled(p) ) + continue; // skip + + m_textStepsDescription[p].LoadFromFont( THEME->GetPathToF("ScreenGameplay StepsDescription") ); + m_textStepsDescription[p].SetName( ssprintf("StepsDescriptionP%i",p+1) ); + Steps* pSteps = GAMESTATE->m_pCurNotes[p]; + ASSERT( pSteps ); + m_textStepsDescription[p].SetText( pSteps->GetDescription() ); + SET_XY( m_textStepsDescription[p] ); + this->AddChild( &m_textStepsDescription[p] ); + } + switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_ARCADE: @@ -2254,6 +2268,7 @@ void ScreenGameplay::TweenOnScreen() ON_COMMAND( m_textCourseSongNumber[p] ); if( GAMESTATE->m_PlayMode == PLAY_MODE_RAVE ) ON_COMMAND( m_textPlayerName[p] ); + ON_COMMAND( m_textStepsDescription[p] ); if( m_pPrimaryScoreDisplay[p] ) ON_COMMAND( *m_pPrimaryScoreDisplay[p] ); if( m_pSecondaryScoreDisplay[p] ) @@ -2283,6 +2298,7 @@ void ScreenGameplay::TweenOffScreen() OFF_COMMAND( m_textCourseSongNumber[p] ); if( GAMESTATE->m_PlayMode == PLAY_MODE_RAVE ) OFF_COMMAND( m_textPlayerName[p] ); + OFF_COMMAND( m_textStepsDescription[p] ); if( m_pPrimaryScoreDisplay[p] ) OFF_COMMAND( *m_pPrimaryScoreDisplay[p] ); if( m_pSecondaryScoreDisplay[p] ) diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 8a91c14a88..a888913359 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -116,6 +116,7 @@ protected: Sprite m_sprCourseSongNumber; BitmapText m_textCourseSongNumber[NUM_PLAYERS]; BitmapText m_textPlayerName[NUM_PLAYERS]; + BitmapText m_textStepsDescription[NUM_PLAYERS]; BPMDisplay m_BPMDisplay; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 2a3d1bae21..50518d75d3 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -49,7 +49,8 @@ Sprite::~Sprite() bool Sprite::LoadBG( RageTextureID ID ) { - ID.iMipMaps = 1; + ID.bMipMaps = true; + // Don't we want to dither 16 bit textures at least? // ID.bDither = true; return Load(ID); }