//Draw lower-right part of rectangle's "shadow". void drawLowRightShadow( const Rect &rect, const GFXColor &color, float lineWidth ) { GFXDisable( TEXTURE0 ); GFXLineWidth( lineWidth ); GFXColorf( color ); const float verts[3 * 3] = { rect.origin.x, rect.origin.y, 0, rect.origin.x+rect.size.width, rect.origin.y, 0, rect.origin.x+rect.size.width, rect.origin.y+rect.size.height, 0, }; GFXDraw( GFXLINESTRIP, verts, 3 ); GFXEnable( TEXTURE0 ); }
//Draw the outline of a rectangle using the specified color. void drawRectOutline( const Rect &rect, const GFXColor &color, float lineWidth ) { GFXDisable( TEXTURE0 ); GFXLineWidth( lineWidth ); GFXColorf( color ); const float verts[5 * 3] = { rect.left(), rect.top(), 0, rect.right(), rect.top(), 0, rect.right(), rect.bottom(), 0, rect.left(), rect.bottom(), 0, rect.left(), rect.top(), 0, }; GFXDraw( GFXLINESTRIP, verts, 5 ); GFXEnable( TEXTURE0 ); }
void SphereDisplay::DrawTargetMarker(const Vector& position, float trackSize) { // Crosshair const float crossSize = 8.0; const float xcross = crossSize / g_game.x_resolution; const float ycross = crossSize / g_game.y_resolution; // The crosshair wiggles as it moves around. The wiggling is less noticable // when the crosshair is drawn with the smooth option. GFXEnable(SMOOTH); GFXLineWidth(trackSize); GFXBegin(GFXLINE); GFXVertex3f(position.x + xcross, position.y, 0.0f); GFXVertex3f(position.x - xcross, position.y, 0.0f); GFXVertex3f(position.x, position.y - ycross, 0.0f); GFXVertex3f(position.x, position.y + ycross, 0.0f); GFXEnd(); GFXDisable(SMOOTH); }
void SphereDisplay::DrawBackground(const Sensor& sensor, const ViewArea& radarView) { // Split crosshair if (!radarView.IsActive()) return; GFXColor groundColor = radarView.GetColor(); float velocity = sensor.GetPlayer()->GetWarpVelocity().Magnitude(); float logvelocity = 3.0; // std::log10(1000.0); if (velocity > 1000.0) { // Max logvelocity is log10(speed_of_light) = 10.46 logvelocity = std::log10(velocity); } const float size = 3.0 * logvelocity; // [9; 31] const float xground = size / g_game.x_resolution; const float yground = size / g_game.y_resolution; Vector center = radarView.Scale(Vector(0.0, 0.0, 0.0)); GFXEnable(SMOOTH); GFXLineWidth(1); GFXColorf(groundColor); GFXBegin(GFXLINE); GFXVertexf(Vector(center.x - 2.0 * xground, center.y, center.z)); GFXVertexf(Vector(center.x - xground, center.y, center.z)); GFXVertexf(Vector(center.x + 2.0 * xground, center.y, center.z)); GFXVertexf(Vector(center.x + xground, center.y, center.z)); GFXVertexf(Vector(center.x, center.y - 2.0 * yground, center.z)); GFXVertexf(Vector(center.x, center.y - yground, center.z)); GFXVertexf(Vector(center.x, center.y + 2.0 * yground, center.z)); GFXVertexf(Vector(center.x, center.y + yground, center.z)); GFXEnd(); GFXDisable(SMOOTH); }