void BitmapText::UpdateBaseZoom() { if( m_fMaxWidth == 0 ) { this->SetBaseZoomX( 1 ); } else { const float fWidth = GetUnzoomedWidth(); if( fWidth != 0 ) // don't divide by 0 { /* Never decrease the zoom. */ const float fZoom = min( 1, m_fMaxWidth/fWidth ); this->SetBaseZoomX( fZoom ); } } if( m_fMaxHeight == 0 ) { this->SetBaseZoomY( 1 ); } else { const float fHeight = GetUnzoomedHeight(); if( fHeight != 0 ) // don't divide by 0 { /* Never decrease the zoom. */ const float fZoom = min( 1, m_fMaxHeight/fHeight ); this->SetBaseZoomY( fZoom ); } } }
void GrooveRadar::GrooveRadarValueMap::DrawPrimitives() { ActorFrame::DrawPrimitives(); // draw radar filling const float fRadius = GetUnzoomedWidth()/2.0f*1.1f; DISPLAY->ClearAllTextures(); DISPLAY->SetTextureMode( TextureUnit_1, TextureMode_Modulate ); RageSpriteVertex v[12]; // needed to draw 5 fan primitives and 10 strip primitives // xxx: We could either make the values invisible or draw a dot // (simulating real DDR). TODO: Make that choice up to the themer. -aj if( !m_bValuesVisible ) return; // use a fan to draw the volume RageColor color = this->m_pTempState->diffuse[0]; color.a = 0.5f; v[0].p = RageVector3( 0, 0, 0 ); RageColor midcolor = color; midcolor.a = RADAR_CENTER_ALPHA; v[0].c = midcolor; v[1].c = color; for( int i=0; i<NUM_SHOWN_RADAR_CATEGORIES+1; i++ ) // do one extra to close the fan { const int c = i%NUM_SHOWN_RADAR_CATEGORIES; const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); const float fX = RageFastCos(fRotation) * fDistFromCenter; const float fY = -RageFastSin(fRotation) * fDistFromCenter; v[1+i].p = RageVector3( fX, fY, 0 ); v[1+i].c = v[1].c; } DISPLAY->DrawFan( v, NUM_SHOWN_RADAR_CATEGORIES+2 ); // use a line loop to draw the thick line for( int i=0; i<=NUM_SHOWN_RADAR_CATEGORIES; i++ ) { const int c = i%NUM_SHOWN_RADAR_CATEGORIES; const float fDistFromCenter = ( m_fValuesOld[c] * (1-m_PercentTowardNew) + m_fValuesNew[c] * m_PercentTowardNew + 0.07f ) * fRadius; const float fRotation = RADAR_VALUE_ROTATION(i); const float fX = RageFastCos(fRotation) * fDistFromCenter; const float fY = -RageFastSin(fRotation) * fDistFromCenter; v[i].p = RageVector3( fX, fY, 0 ); v[i].c = this->m_pTempState->diffuse[0]; } // TODO: Add this back in -Chris // switch( PREFSMAN->m_iPolygonRadar ) // { // case 0: DISPLAY->DrawLoop_LinesAndPoints( v, NUM_SHOWN_RADAR_CATEGORIES, RADAR_EDGE_WIDTH ); break; // case 1: DISPLAY->DrawLoop_Polys( v, NUM_SHOWN_RADAR_CATEGORIES, RADAR_EDGE_WIDTH ); break; // default: // case -1: DISPLAY->DrawLineStrip( v, NUM_SHOWN_RADAR_CATEGORIES+1, RADAR_EDGE_WIDTH ); // break; // } }