Exemple #1
0
bool
AirspacePreviewRenderer::PrepareFill(
    Canvas &canvas, AirspaceClass type, const AirspaceLook &look,
    const AirspaceRendererSettings &settings)
{
  const AirspaceClassRendererSettings &class_settings = settings.classes[type];

  if (class_settings.fill_mode ==
      AirspaceClassRendererSettings::FillMode::NONE)
    return false;

#ifdef ENABLE_OPENGL
  ::glEnable(GL_BLEND);
  ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  Color color = class_settings.fill_color;
  canvas.Select(Brush(color.WithAlpha(48)));
#elif defined(ENABLE_SDL)
  Color color = class_settings.fill_color;
  canvas.Select(Brush(LightColor(color)));
#else
  canvas.Select(look.brushes[settings.transparency ?
                             3 : class_settings.brush]);
  canvas.SetTextColor(LightColor(class_settings.fill_color));
  canvas.SetMixMask();
#endif

  canvas.SelectNullPen();

  return true;
}
Exemple #2
0
 void BeveledRectangle(Pt ul, Pt lr, Clr color, Clr border_color, bool up, unsigned int bevel_thick/* = 2*/,
                       bool bevel_left/* = true*/, bool bevel_top/* = true*/, bool bevel_right/* = true*/, bool bevel_bottom/* = true*/)
 {
     Rectangle(ul, lr, color,
               (up ? LightColor(border_color) : DarkColor(border_color)),
               (up ? DarkColor(border_color) : LightColor(border_color)),
               bevel_thick, bevel_left, bevel_top, bevel_right, bevel_bottom);
 }
Exemple #3
0
 void BeveledRoundedRectangle(Pt ul, Pt lr, Clr color, Clr border_color, bool up,
                              unsigned int corner_radius/* = 5*/,
                              unsigned int bevel_thick/* = 2*/)
 {
     RoundedRectangle(ul, lr, color,
                      (up ? LightColor(border_color) : DarkColor(border_color)),
                      (up ? DarkColor(border_color) : LightColor(border_color)),
                      corner_radius, bevel_thick);
 }
Exemple #4
0
/**
 * Returns a lighter version of the specified color, adequate for
 * SRCAND filtering.
 */
static inline constexpr Color
LightColor(Color c)
{
#ifdef GREYSCALE
  return Color(LightColor(c.GetLuminosity()));
#else
  return Color(LightColor(c.Red()), LightColor(c.Green()),
               LightColor(c.Blue()));
#endif
}
Exemple #5
0
void
Canvas::DrawButton(PixelRect rc, bool down)
{
  const Pen old_pen = pen;

  Color gray = COLOR_LIGHT_GRAY;
  DrawFilledRectangle(rc, gray);

  Pen bright(1, LightColor(gray));
  Pen dark(1, DarkColor(gray));

  Select(down ? dark : bright);
  DrawTwoLines(rc.left, rc.bottom - 2, rc.left, rc.top,
            rc.right - 2, rc.top);
  DrawTwoLines(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1,
            rc.right - 3, rc.top + 1);

  Select(down ? bright : dark);
  DrawTwoLines(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1,
            rc.right - 1, rc.top + 1);
  DrawTwoLines(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2,
            rc.right - 2, rc.top + 2);

  pen = old_pen;
}
Exemple #6
0
void
GestureLook::Initialise()
{
  color = COLOR_RED;
  pen.Create(Layout::ScalePenWidth(5), color);

  invalid_color = LightColor(color);
  invalid_pen.Create(Layout::ScalePenWidth(5), invalid_color);
}
Exemple #7
0
void
WaypointLook::Initialise(const WaypointRendererSettings &settings)
{
  small_icon.Load(IDB_SMALL, IDB_SMALL_HD);
  turn_point_icon.Load(IDB_TURNPOINT, IDB_TURNPOINT_HD);
  task_turn_point_icon.Load(IDB_TASKTURNPOINT, IDB_TASKTURNPOINT_HD);
  mountain_top_icon.Load(IDB_MOUNTAIN_TOP, IDB_MOUNTAIN_TOP_HD);
  mountain_pass_icon.Load(IDB_MOUNTAIN_PASS, IDB_MOUNTAIN_PASS_HD);
  bridge_icon.Load(IDB_BRIDGE, IDB_BRIDGE_HD);
  tunnel_icon.Load(IDB_TUNNEL, IDB_TUNNEL_HD);
  tower_icon.Load(IDB_TOWER, IDB_TOWER_HD);
  power_plant_icon.Load(IDB_POWER_PLANT, IDB_POWER_PLANT_HD);
  obstacle_icon.Load(IDB_OBSTACLE, IDB_OBSTACLE_HD);

  reachable_brush.Set(COLOR_GREEN);
  terrain_unreachable_brush.Set(LightColor(COLOR_RED));
  unreachable_brush.Set(COLOR_RED);
  white_brush.Set(COLOR_WHITE);
  light_gray_brush.Set(COLOR_LIGHT_GRAY);
  magenta_brush.Set(COLOR_MAGENTA);
  orange_brush.Set(COLOR_ORANGE);

  if (settings.landable_style == wpLandableWinPilot) {
    airport_reachable_icon.Load(IDB_REACHABLE, IDB_REACHABLE_HD);
    airport_marginal_icon.Load(IDB_MARGINAL, IDB_MARGINAL_HD);
    airport_unreachable_icon.Load(IDB_LANDABLE, IDB_LANDABLE_HD);
    field_reachable_icon.Load(IDB_REACHABLE, IDB_REACHABLE_HD);
    field_marginal_icon.Load(IDB_MARGINAL, IDB_MARGINAL_HD);
    field_unreachable_icon.Load(IDB_LANDABLE, IDB_LANDABLE_HD);
  } else if (settings.landable_style == wpLandableAltA) {
    airport_reachable_icon.Load(IDB_AIRPORT_REACHABLE,
                                    IDB_AIRPORT_REACHABLE_HD);
    airport_marginal_icon.Load(IDB_AIRPORT_MARGINAL,
                                   IDB_AIRPORT_MARGINAL_HD);
    airport_unreachable_icon.Load(IDB_AIRPORT_UNREACHABLE,
                                      IDB_AIRPORT_UNREACHABLE_HD);
    field_reachable_icon.Load(IDB_OUTFIELD_REACHABLE,
                                  IDB_OUTFIELD_REACHABLE_HD);
    field_marginal_icon.Load(IDB_OUTFIELD_MARGINAL,
                                 IDB_OUTFIELD_MARGINAL_HD);
    field_unreachable_icon.Load(IDB_OUTFIELD_UNREACHABLE,
                                    IDB_OUTFIELD_UNREACHABLE_HD);
  } else if (settings.landable_style == wpLandableAltB) {
    airport_reachable_icon.Load(IDB_AIRPORT_REACHABLE,
                                    IDB_AIRPORT_REACHABLE_HD);
    airport_marginal_icon.Load(IDB_AIRPORT_MARGINAL2,
                                   IDB_AIRPORT_MARGINAL2_HD);
    airport_unreachable_icon.Load(IDB_AIRPORT_UNREACHABLE2,
                                      IDB_AIRPORT_UNREACHABLE2_HD);
    field_reachable_icon.Load(IDB_OUTFIELD_REACHABLE,
                                  IDB_OUTFIELD_REACHABLE_HD);
    field_marginal_icon.Load(IDB_OUTFIELD_MARGINAL2,
                                 IDB_OUTFIELD_MARGINAL2_HD);
    field_unreachable_icon.Load(IDB_OUTFIELD_UNREACHABLE2,
                                    IDB_OUTFIELD_UNREACHABLE2_HD);
  }
}
Exemple #8
0
void
VarioBarLook::Initialise(const Font &_font)
{
  const uint8_t alpha = 0xA0;

  brush_sink.Set(ColorWithAlpha(COLOR_RED, alpha));
  brush_sink_avg.Set(ColorWithAlpha(LightColor(COLOR_RED), alpha));
  pen_sink.Set(Layout::ScalePenWidth(1), DarkColor(COLOR_RED));

  brush_climb.Set(ColorWithAlpha(COLOR_GREEN, alpha));
  brush_climb_avg.Set(ColorWithAlpha((LightColor(LightColor(COLOR_GREEN))), alpha));
  pen_climb.Set(Layout::ScalePenWidth(1), DarkColor(COLOR_GREEN));

  brush_mc.Set(ColorWithAlpha(COLOR_GRAY, alpha));
  pen_mc.Set(Layout::ScalePenWidth(1), DarkColor(COLOR_GRAY));

  font = &_font;
}
Exemple #9
0
void
ButtonLook::Initialise(const Font &_font)
{
  font = &_font;

  standard.foreground_color = COLOR_BLACK;
  standard.foreground_brush.Set(standard.foreground_color);
  standard.background_color = COLOR_LIGHT_GRAY;
  standard.light_border_pen.Set(1, LightColor(standard.background_color));
  standard.dark_border_pen.Set(1, DarkColor(standard.background_color));

  focused.foreground_color = COLOR_WHITE;
  focused.foreground_brush.Set(focused.foreground_color);
  focused.background_color = COLOR_XCSOAR_DARK;
  focused.light_border_pen.Set(1, LightColor(focused.background_color));
  focused.dark_border_pen.Set(1, DarkColor(focused.background_color));

  disabled.color = COLOR_GRAY;
  disabled.brush.Set(disabled.color);
}
Exemple #10
0
void
WindArrowLook::Initialise(const Font &_font, bool inverse)
{
  arrow_pen.Create(Layout::Scale(1),
                   inverse
                   ? (HasColors() ? LightColor(COLOR_GRAY) : COLOR_WHITE)
                   : (HasColors() ? DarkColor(COLOR_GRAY) : COLOR_BLACK));
  tail_pen.Create(Pen::DASH2, 1, inverse ? COLOR_WHITE : COLOR_BLACK);
  arrow_brush.Create(IsDithered() ? COLOR_DARK_GRAY : COLOR_GRAY);

  font = &_font;
}
  /**
   * Renders the AbstractAirspace on the canvas
   * @param as AbstractAirspace to render
   */
  void
  Render(const AbstractAirspace& as)
  {
    int type = as.GetType();
    if (type <= 0)
      return;

    // No intersections for this airspace
    if (m_intersections.empty())
      return;

    // Select pens and brushes
#ifndef USE_GDI
    Color color = airspace_look.colors[settings.colours[type]];
#ifdef ENABLE_OPENGL
    color = color.WithAlpha(48);
#endif
    Brush brush(color);
#else
    const Brush &brush = airspace_look.brushes[settings.brushes[type]];
    canvas.SetTextColor(LightColor(airspace_look.colors[settings.colours[type]]));
#endif

    PixelRect rcd;
    // Calculate top and bottom coordinate
    rcd.top = chart.screenY(as.GetTopAltitude(state));
    if (as.IsBaseTerrain())
      rcd.bottom = chart.screenY(fixed_zero);
    else
      rcd.bottom = chart.screenY(as.GetBaseAltitude(state));

    // Iterate through the intersections
    for (auto it = m_intersections.begin(); it != m_intersections.end(); ++it) {
      const GeoPoint p_start = it->first;
      const GeoPoint p_end = it->second;
      const fixed distance_start = start.Distance(p_start);
      const fixed distance_end = start.Distance(p_end);

      // Determine left and right coordinate
      rcd.left = chart.screenX(distance_start);
      rcd.right = chart.screenX(distance_end);

      // only one edge found, next edge must be beyond screen
      if ((rcd.left == rcd.right) && (p_start == p_end)) {
        rcd.right = chart.screenX(chart.getXmax());
      }

      // Draw the airspace
      RenderBox(rcd, brush, settings.black_outline, type);
    }
  }
Exemple #12
0
void CMine::AutoAdjustLight (double fLightScale, bool bAll, bool bCopyTexLights) 
{
	int			segnum;
	int			texture_num;
	int			sidenum;
	UINT32		brightness;
	CDSegment	*seg;
	CDSide		*side;

// clear all lighting on marked cubes
theApp.SetModified (TRUE);
theApp.LockUndo ();
if (bAll)
	memset (VertexColors (), 0, sizeof (MineData ().vertexColors));
for (segnum = SegCount (), seg = Segments (); segnum; segnum--, seg++)
	if (bAll || (seg->wall_bitmask & MARKED_MASK))
		for (sidenum=0, side = seg->sides;sidenum < MAX_SIDES_PER_SEGMENT; sidenum++, side++) {
			int i;
			for (i = 0; i < 4; i++) {
				side->uvls [i].l = 0;
				if (!bAll)
					memset (VertexColors (seg->verts [side_vert [sidenum][i]]), 0, sizeof (CDColor));
				}
			}

// Calculate cube side corner light values
// for each marked side in the level
// (range: 0 = min, 0x8000 = max)
for (segnum = 0, seg = Segments (); segnum < SegCount (); segnum++, seg++) {
	for (sidenum = 0, side = seg->sides; sidenum < 6; sidenum++, side++) {
		if (!(bAll || SideIsMarked (segnum, sidenum)))
			continue;
		if ((seg->children [sidenum] >= 0) && !VisibleWall (side->nWall))
			continue;
		if (bCopyTexLights)
			memset (LightColor (segnum, sidenum, false), 0, sizeof (CDColor));
		brightness = 0;
		texture_num = side->nBaseTex;
		if ((texture_num >= 0) && (texture_num < MAX_TEXTURES))
			brightness = max (brightness, LightWeight (texture_num));
		texture_num = side->nOvlTex & 0x3fff;
		if ((texture_num > 0) && (texture_num < MAX_TEXTURES))
			brightness = max (brightness, LightWeight (texture_num));
		if (brightness > 0)
			Illuminate (segnum, sidenum, (UINT32) (brightness * 2 * fLightScale), 1.0, bAll, bCopyTexLights);
		}
	}
theApp.UnlockUndo ();
}
Exemple #13
0
void
ButtonLook::Initialise(const Font &_font)
{
  font = &_font;

  standard.foreground_color = COLOR_BLACK;
  standard.foreground_brush.Set(standard.foreground_color);
  standard.background_color = IsDithered() ? COLOR_WHITE : COLOR_LIGHT_GRAY;
  if (IsDithered()) {
    standard.light_border_pen.Set(1, COLOR_BLACK);
    standard.dark_border_pen.Set(1, COLOR_BLACK);
  } else if (!HasColors()) {
    standard.light_border_pen.Set(1, LightColor(COLOR_DARK_GRAY));
    standard.dark_border_pen.Set(1, COLOR_BLACK);
  } else {
    standard.light_border_pen.Set(1, LightColor(standard.background_color));
    standard.dark_border_pen.Set(1, DarkColor(standard.background_color));
  }

  focused.foreground_color = COLOR_WHITE;
  focused.foreground_brush.Set(focused.foreground_color);
  focused.background_color = IsDithered() ? COLOR_BLACK : COLOR_XCSOAR_DARK;
  if (IsDithered()) {
    focused.light_border_pen.Set(1, COLOR_WHITE);
    focused.dark_border_pen.Set(1, COLOR_WHITE);
  } else if (!HasColors()) {
    focused.light_border_pen.Set(1, LightColor(COLOR_DARK_GRAY));
    focused.dark_border_pen.Set(1, COLOR_BLACK);
  } else {
    focused.light_border_pen.Set(1, LightColor(focused.background_color));
    focused.dark_border_pen.Set(1, DarkColor(focused.background_color));
  }

  disabled.color = COLOR_GRAY;
  disabled.brush.Set(disabled.color);
}
  void SetBufferPens(const AbstractAirspace &airspace) {
    AirspaceClass airspace_class = airspace.GetType();

#ifndef HAVE_HATCHED_BRUSH
    buffer.Select(look.solid_brushes[airspace_class]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      buffer.Select(look.solid_brushes[airspace_class]);
    } else {
#endif
      // this color is used as the black bit
      buffer.SetTextColor(LightColor(settings.classes[airspace_class].fill_color));

      // get brush, can be solid or a 1bpp bitmap
      buffer.Select(look.brushes[settings.classes[airspace_class].brush]);

      buffer.SetBackgroundOpaque();
      buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    buffer.SelectNullPen();

    if (use_stencil) {
      if (warnings.HasWarning(airspace) || warnings.IsInside(airspace) ||
          settings.classes[airspace_class].fill_mode ==
          AirspaceClassRendererSettings::FillMode::ALL) {
        stencil.SelectBlackBrush();
        stencil.SelectNullPen();
      } else {
        stencil.Select(look.thick_pen);
        stencil.SelectHollowBrush();
      }
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
Exemple #15
0
void
TaskLook::Initialise()
{
  // Magenta ICAO color is 0x65,0x23,0x1c
  const Color task_color = Color(0x62, 0x4e, 0x90);
  const Color bearing_color = Color(0x3e, 0x30, 0x5f);
  const Color isoline_color = bearing_color;

  oz_current_pen.Create(Pen::SOLID, Layout::ScalePenWidth(2), task_color);
  oz_active_pen.Create(Pen::SOLID, Layout::ScalePenWidth(1), task_color);
  oz_inactive_pen.Create(Pen::SOLID, Layout::ScalePenWidth(1),
                      DarkColor(task_color));

  leg_active_pen.Create(Pen::DASH, Layout::ScalePenWidth(2), task_color);
  leg_inactive_pen.Create(Pen::DASH, Layout::ScalePenWidth(1), task_color);
  arrow_pen.Create(Layout::ScalePenWidth(1), task_color);

  isoline_pen.Create(Pen::DASH, Layout::ScalePenWidth(1), isoline_color);

  bearing_pen.Create(Layout::ScalePenWidth(2),
                  HasColors() ? bearing_color : COLOR_BLACK);
  best_cruise_track_brush.Create(bearing_color);
  best_cruise_track_pen.Create(Layout::ScalePenWidth(1),
                               HasColors()
                               ? DarkColor(bearing_color)
                               : COLOR_BLACK);

  highlight_pen.Create(Layout::ScalePenWidth(4), COLOR_BLACK);

  target_icon.LoadResource(IDB_TARGET, IDB_TARGET_HD);

  hbGray.Create(COLOR_GRAY);
  hbGreen.Create(COLOR_GREEN);
  hbOrange.Create(COLOR_ORANGE);
  hbLightGray.Create(COLOR_LIGHT_GRAY);
  hbNotReachableTerrain.Create(LightColor(COLOR_RED));
}
Exemple #16
0
int SFObjectMD2::Init() 
{
	// For each animation we use one SMesh
	for ( int i = 0; i < GetFrameCount(); i++ )
	{
		MODELVERTEX pVertex;
		
		D3DXCOLOR	LightColor(1.0f, 1.0f, 1.0f, 1.0f );
		for( int j = 0; j < GetTriangleCount(); j++) 
		{
			pVertex.m_vecPos.x = m_frame_list[i].vertex[m_index_list[j].a].x;
			pVertex.m_vecPos.y = m_frame_list[i].vertex[m_index_list[j].a].z;
			pVertex.m_vecPos.z = m_frame_list[i].vertex[m_index_list[j].a].y;
			pVertex.m_vecTex.x = m_index_list[j].a_s;
			pVertex.m_vecTex.y = m_index_list[j].a_t;
			pVertex.m_dwDiffuse = LightColor;
			m_data[i].vertex.push_back (pVertex);
			
			pVertex.m_vecPos.x = m_frame_list[i].vertex[m_index_list[j].b].x;
			pVertex.m_vecPos.y = m_frame_list[i].vertex[m_index_list[j].b].z;
			pVertex.m_vecPos.z = m_frame_list[i].vertex[m_index_list[j].b].y;
			pVertex.m_vecTex.x = m_index_list[j].b_s;
			pVertex.m_vecTex.y = m_index_list[j].b_t;
			pVertex.m_dwDiffuse = LightColor;
			m_data[i].vertex.push_back (pVertex);
			
			pVertex.m_vecPos.x = m_frame_list[i].vertex[m_index_list[j].c].x;
			pVertex.m_vecPos.y = m_frame_list[i].vertex[m_index_list[j].c].z;
			pVertex.m_vecPos.z = m_frame_list[i].vertex[m_index_list[j].c].y;
			pVertex.m_vecTex.x = m_index_list[j].c_s;
			pVertex.m_vecTex.y = m_index_list[j].c_t;
			pVertex.m_dwDiffuse = LightColor;
			m_data[i].vertex.push_back (pVertex);		
		}
	}
	return 1;
}
  void set_buffer_pens(const AbstractAirspace &airspace) {
    const unsigned color_index = settings.colours[airspace.GetType()];

#ifndef HAVE_HATCHED_BRUSH
    m_buffer.Select(airspace_look.solid_brushes[color_index]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      m_buffer.Select(airspace_look.solid_brushes[color_index]);
    } else {
#endif
      // this color is used as the black bit
      m_buffer.SetTextColor(LightColor(airspace_look.colors[color_index]));

      // get brush, can be solid or a 1bpp bitmap
      m_buffer.Select(airspace_look.brushes[settings.brushes[airspace.GetType()]]);

      m_buffer.SetBackgroundOpaque();
      m_buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    m_buffer.SelectNullPen();

    if (m_warnings.is_warning(airspace) || m_warnings.is_inside(airspace)) {
      m_stencil.SelectBlackBrush();
      m_stencil.Select(airspace_look.medium_pen);
    } else {
      m_stencil.Select(airspace_look.thick_pen);
      m_stencil.SelectHollowBrush();
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    ui->setupUi(this);
    ui->tab_2->setEnabled(false);
    ui->pushButton_3->setEnabled(false);
    ui->btnSmooth->setEnabled(false);
    ui->menuExperimenta->setEnabled(false);
    ui->actionSave_Laplace_Matrix->setEnabled(false);
    connect(ui->glWidget, SIGNAL(faceCount(int)), ui->faceCount, SLOT(display(int)));
    connect(ui->glWidget, SIGNAL(vertexCount(int)), ui->vertexCount, SLOT(display(int)));
    connect(ui->radioButton, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light0State(bool)));
    connect(ui->radioButton_2, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light1State(bool)));
    connect(ui->radioButton_3, SIGNAL(toggled(bool)), ui->glWidget, SLOT(Light2State(bool)));

    connect(ui->glWidget,SIGNAL(SendVector(VectorXd)), &plotWin, SLOT(getVector(VectorXd)));

    connect(&posLight, SIGNAL(posX(int)), ui->glWidget, SLOT(LightPosX(int)));
    connect(&posLight, SIGNAL(posY(int)), ui->glWidget, SLOT(LightPosY(int)));
    connect(&posLight, SIGNAL(posZ(int)), ui->glWidget, SLOT(LightPosZ(int)));

    connect(&matWin, SIGNAL(amb(QColor)), ui->glWidget, SLOT(glAmb(QColor)));
    connect(&matWin, SIGNAL(diffuse(QColor)), ui->glWidget, SLOT(glDiffuse(QColor)));
    connect(&matWin, SIGNAL(spec(QColor)), ui->glWidget, SLOT(glSpec(QColor)));
    connect(&posLight, SIGNAL(sendLightColor(QColor)), ui->glWidget, SLOT(LightColor(QColor)));


    connect(&selectLaplacian, SIGNAL(selectKind(int)), ui->glWidget, SLOT(SelectLaplace(int)));
    connect(this, SIGNAL(sendEigenIndex(int)), ui->glWidget, SLOT(SeekEigen(int)));
    connect(this, SIGNAL(sendCompressionVolume(int)), ui->glWidget, SLOT(AdjustCompression(int)));
    connect(this, SIGNAL(analyseCurve()), ui->glWidget, SLOT(AnalyseCurve()));
    connect(ui->glWidget, SIGNAL(Status(QString)), this, SLOT(setStatus(QString)));
    connect(this, SIGNAL(shadingMode(int)), ui->glWidget, SLOT(selectShade(int)));
}
Exemple #19
0
void
WaypointLook::Initialise(const WaypointRendererSettings &settings,
                         const Font &_font, const Font &_bold_font)
{
  small_icon.LoadResource(IDB_SMALL, IDB_SMALL_HD);
  turn_point_icon.LoadResource(IDB_TURNPOINT, IDB_TURNPOINT_HD);
  task_turn_point_icon.LoadResource(IDB_TASKTURNPOINT, IDB_TASKTURNPOINT_HD);
  mountain_top_icon.LoadResource(IDB_MOUNTAIN_TOP, IDB_MOUNTAIN_TOP_HD);
  mountain_pass_icon.LoadResource(IDB_MOUNTAIN_PASS, IDB_MOUNTAIN_PASS_HD);
  bridge_icon.LoadResource(IDB_BRIDGE, IDB_BRIDGE_HD);
  tunnel_icon.LoadResource(IDB_TUNNEL, IDB_TUNNEL_HD);
  tower_icon.LoadResource(IDB_TOWER, IDB_TOWER_HD);
  power_plant_icon.LoadResource(IDB_POWER_PLANT, IDB_POWER_PLANT_HD);
  obstacle_icon.LoadResource(IDB_OBSTACLE, IDB_OBSTACLE_HD);
  thermal_hotspot_icon.LoadResource(IDB_THERMAL_HOTSPOT, IDB_THERMAL_HOTSPOT_HD);

  reachable_brush.Set(COLOR_GREEN);
  terrain_unreachable_brush.Set(LightColor(COLOR_RED));
  unreachable_brush.Set(COLOR_RED);
  white_brush.Set(COLOR_WHITE);
  light_gray_brush.Set(COLOR_LIGHT_GRAY);
  magenta_brush.Set(COLOR_MAGENTA);
  orange_brush.Set(COLOR_ORANGE);

  switch (settings.landable_style) {
  case WaypointRendererSettings::LandableStyle::PURPLE_CIRCLE:
    airport_reachable_icon.LoadResource(IDB_REACHABLE, IDB_REACHABLE_HD);
    airport_marginal_icon.LoadResource(IDB_MARGINAL, IDB_MARGINAL_HD);
    airport_unreachable_icon.LoadResource(IDB_LANDABLE, IDB_LANDABLE_HD);
    field_reachable_icon.LoadResource(IDB_REACHABLE, IDB_REACHABLE_HD);
    field_marginal_icon.LoadResource(IDB_MARGINAL, IDB_MARGINAL_HD);
    field_unreachable_icon.LoadResource(IDB_LANDABLE, IDB_LANDABLE_HD);
    break;

  case WaypointRendererSettings::LandableStyle::BW:
    airport_reachable_icon.LoadResource(IDB_AIRPORT_REACHABLE,
                                    IDB_AIRPORT_REACHABLE_HD);
    airport_marginal_icon.LoadResource(IDB_AIRPORT_MARGINAL,
                                   IDB_AIRPORT_MARGINAL_HD);
    airport_unreachable_icon.LoadResource(IDB_AIRPORT_UNREACHABLE,
                                      IDB_AIRPORT_UNREACHABLE_HD);
    field_reachable_icon.LoadResource(IDB_OUTFIELD_REACHABLE,
                                  IDB_OUTFIELD_REACHABLE_HD);
    field_marginal_icon.LoadResource(IDB_OUTFIELD_MARGINAL,
                                 IDB_OUTFIELD_MARGINAL_HD);
    field_unreachable_icon.LoadResource(IDB_OUTFIELD_UNREACHABLE,
                                    IDB_OUTFIELD_UNREACHABLE_HD);
    break;

  case WaypointRendererSettings::LandableStyle::TRAFFIC_LIGHTS:
    airport_reachable_icon.LoadResource(IDB_AIRPORT_REACHABLE,
                                    IDB_AIRPORT_REACHABLE_HD);
    airport_marginal_icon.LoadResource(IDB_AIRPORT_MARGINAL2,
                                   IDB_AIRPORT_MARGINAL2_HD);
    airport_unreachable_icon.LoadResource(IDB_AIRPORT_UNREACHABLE2,
                                      IDB_AIRPORT_UNREACHABLE2_HD);
    field_reachable_icon.LoadResource(IDB_OUTFIELD_REACHABLE,
                                  IDB_OUTFIELD_REACHABLE_HD);
    field_marginal_icon.LoadResource(IDB_OUTFIELD_MARGINAL2,
                                 IDB_OUTFIELD_MARGINAL2_HD);
    field_unreachable_icon.LoadResource(IDB_OUTFIELD_UNREACHABLE2,
                                    IDB_OUTFIELD_UNREACHABLE2_HD);
    break;
  }

  font = &_font;
  bold_font = &_bold_font;
}
Exemple #20
0
 void BeveledX(Pt ul, Pt lr, Clr color)
 { XMark(ul, lr, color, LightColor(color), DarkColor(color)); }
Exemple #21
0
 void BeveledCheck(Pt ul, Pt lr, Clr color)
 { Check(ul, lr, color, LightColor(color), DarkColor(color)); }
Exemple #22
0
 LFXE_API LightColor Device::GetLightColor(const size_t lightIndex) {
     if (this->lightColor.size() > lightIndex) {
         return this->lightColor[lightIndex];
     }
     return LightColor(0, 0, 0, 0);
 }
Exemple #23
0
COLORREF TranslateColor(COLORREF clr, int nTransalte)
{
	return nTransalte == 0 ? clr : nTransalte > 0 ? LightColor(clr, nTransalte) : DarkColor(clr, nTransalte);
}
Exemple #24
0
void CMine::Illuminate (
	INT16 source_segnum, 
	INT16 source_sidenum, 
	UINT32 brightness, 
	double fLightScale, 
	bool bAll, bool 
	bCopyTexLights) 
{
CDSegment	*seg = Segments ();
CDSegment	*child_seg;
double		effect[4];
// find orthogonal angle of source segment
vms_vector A;

//fLightScale /= 100.0;
CalcOrthoVector (A,source_segnum,source_sidenum);
// remember to flip the sign since we want it to point inward
A.x = -A.x;
A.y = -A.y;
A.z = -A.z;

// calculate the center of the source segment
vms_vector source_center;
CalcCenter (source_center,source_segnum,source_sidenum);
if ((source_segnum == 911) && (source_sidenum == 3))
	A = A;
// mark those Segments () within N children of current cube

// set child numbers
//Segments ()[source_segnum].seg_number = m_lightRenderDepth;
int i;
for (i = SegCount (); i; i--, seg++)
	seg->seg_number = -1;
SetSegmentChildNum (NULL, source_segnum, m_lightRenderDepth);
CDColor *plc = LightColor (source_segnum, source_sidenum);
if (!plc->index) {
	plc->index = 255;
	plc->color.r =
	plc->color.g =
	plc->color.b = 1.0;
	}
if (UseTexColors () && bCopyTexLights) {
	CDColor	*psc = LightColor (source_segnum, source_sidenum, false);
	*psc = *plc;
	}
seg = Segments (source_segnum);
seg->seg_number = m_lightRenderDepth;
bool bWall = false; //FindWall (source_segnum, source_sidenum) != NULL;
// loop on child Segments ()
int child_segnum;
for (child_segnum=0, child_seg = Segments ();child_segnum<SegCount ();child_segnum++, child_seg++) {
	// skip if this is not viewable
	if (child_seg->seg_number < 0) 
		continue;
	// skip if not marked
//	if (!(bAll || (child_seg->wall_bitmask & MARKED_MASK)))
//		continue;
	// setup source corner vertex for length calculation later
	vms_vector source_corner[4];
	int j;
	for (j = 0; j < 4; j++) {
		int vertnum = side_vert [source_sidenum][j];
		int h = seg->verts [vertnum];
		source_corner[j].x = Vertices (h)->x;
		source_corner[j].y = Vertices (h)->y;
		source_corner[j].z = Vertices (h)->z;
		}
	// loop on child sides
	int child_sidenum;
	for (child_sidenum = 0; child_sidenum < 6; child_sidenum++) {
		// if side has a child..
		if (!(bAll || SideIsMarked (child_segnum, child_sidenum)))
			continue;
		if (child_seg->children[child_sidenum] >= 0) {
			UINT16 nWall = child_seg->sides[child_sidenum].nWall;
			// .. but there is no wall ..
			if (nWall >= GameInfo ().walls.count)
				continue;
				// .. or its not a door ..
			if (Walls (nWall)->type == WALL_OPEN)
				continue;
			}

//		CBRK (psc->index > 0);
		// if the child side is the same as the source side, then set light and continue
#ifdef _DEBUG
		CBRK (child_segnum == qqq1 && child_sidenum == qqq2);
#endif
		if (child_sidenum == source_sidenum && child_segnum == source_segnum) {
			uvl		*uvlP = child_seg->sides [child_sidenum].uvls;
			UINT32	vBr, lBr;

			theApp.SetModified (TRUE);
			int j;
			for (j = 0; j < 4; j++, uvlP++) {
				CDColor *pvc = VertexColors (child_seg->verts [side_vert [child_sidenum][j]]);
				vBr = (UINT16) uvlP->l;
				lBr = (UINT32) (brightness * fLightScale);
				BlendColors (plc, pvc, lBr, vBr);
				vBr += lBr;
				vBr = min (0x8000, vBr);
				uvlP->l = (UINT16) vBr;
				}
			continue;
			}

		// calculate vector between center of source segment and center of child
//		CBRK (child_segnum == 1 && child_sidenum == 2);
		if (CalcSideLights (child_segnum, child_sidenum, source_center, source_corner, A, effect, fLightScale, bWall)) {
				UINT32	vBr, lBr;	//vertex brightness, light brightness
				uvl		*uvlP = child_seg->sides [child_sidenum].uvls;

			theApp.SetModified (TRUE);
			int j;
			for (j = 0; j < 4; j++, uvlP++) {
				CDColor *pvc = VertexColors (child_seg->verts [side_vert [child_sidenum][j]]);
				if (child_seg->verts [side_vert [child_sidenum][j]] == 2368)
					j = j;
				vBr = (UINT16) uvlP->l;
				lBr = (UINT16) (brightness * effect [j] / 32);
				BlendColors (plc, pvc, lBr, vBr);
				vBr += lBr;
				vBr = min (0x8000, vBr);
				uvlP->l = (UINT16) vBr;
				}
			}
		}
	}
}