Ejemplo n.º 1
0
void MagicView::OnSelectInverse() 
{
   Solid*      solid    = GetDocument()->GetSolid();
   Selector*   selector = GetDocument()->GetSelector();

   if (IsUVEdit()) {
      uvmap_view->SelectInverse();
   }

   else if (solid && selector) {
      selector->UseModel(solid->GetModel());
      selector->SelectInverse();
   }
}
Ejemplo n.º 2
0
void MagicView::OnSelectNone() 
{
   Solid*      solid    = GetDocument()->GetSolid();
   Selector*   selector = GetDocument()->GetSelector();

   if (IsUVEdit()) {
      uvmap_view->SelectNone();
   }

   else if (solid && selector) {
      selector->UseModel(solid->GetModel());
      selector->SelectAll(Selector::SELECT_REMOVE);
   }
}
Ejemplo n.º 3
0
void MagicView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
   CView::OnUpdate(pSender, lHint, pHint);

   Solid*      solid    = GetDocument()->GetSolid();
   Selection*  seln     = GetDocument()->GetSelection();
   Selector*   selector = GetDocument()->GetSelector();

   if (solid && scene) {
      scene->Graphics().clear();
      scene->AddGraphic(solid);
      scene->AddGraphic(seln);
      scene->AddGraphic(selector);
   }

   if (selector)
      selector->UseModel(solid->GetModel());
}
Ejemplo n.º 4
0
void MagicView::OnEditRedo() 
{
   MagicDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
   pDoc->Redo();

   Solid*      solid    = GetDocument()->GetSolid();
   Selector*   selector = GetDocument()->GetSelector();

   if (selector) {
      selector->UseModel(solid->GetModel());
      selector->Reselect();
   }

   Invalidate();
   pDoc->SetModifiedFlag(TRUE);
   pDoc->UpdateAllViews(this);
}
Ejemplo n.º 5
0
void MagicView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
   Color::SetPalette(standard_palette, 256, inverse_palette);

   if (!video_settings)
      video_settings = new VideoSettings;

   GetClientRect(&client_rect);

   // Use client area to set video window size
   int w = client_rect.right - client_rect.left;
   int h = client_rect.bottom - client_rect.top;

   video_settings->is_windowed   = true;
   video_settings->window_width  = w;
   video_settings->window_height = h;

   if (!video) {
      video = new VideoDX9(GetSafeHwnd(), video_settings);
      *video_settings = *video->GetVideoSettings();

      if (video) {
         Color::UseVideo(video);
         video->UseXFont("System", 12, false, false);

         screen = new Screen(video);
         if (!screen) {
            ::Print("ERROR: Could not create Screen object.\n");
            return;
         }

         ::Print("  Created screen object (%d x %d).\n", w, h);
   
         if (!screen->SetBackgroundColor(Color::Black))
            ::Print("  WARNING: could not set video background color to Black\n");

         screen->ClearAllFrames(true);

         ::Print("  Established requested video parameters.\n");
         ::Print("  ---------------------------------------\n\n");

         if (!scene) {
            scene = new Scene;

            scene->SetAmbient(Color(60,60,60));

            Point light_pos(3e6, 5e6, 4e6);

            main_light = new Light(1.0f); //1.25f);
            main_light->MoveTo(light_pos);
            main_light->SetType(Light::LIGHT_DIRECTIONAL);
            main_light->SetColor(Color::White);
            main_light->SetShadow(true);

            scene->AddLight(main_light);

            back_light = new Light(0.5f);
            back_light->MoveTo(light_pos * -1);
            back_light->SetType(Light::LIGHT_DIRECTIONAL);
            back_light->SetColor(Color::White);

            scene->AddLight(back_light);

            Selection*  seln     = GetDocument()->GetSelection();
            Selector*   selector = GetDocument()->GetSelector();

            if (seln && selector) {
               scene->Graphics().clear();
               scene->AddGraphic(seln);
               scene->AddGraphic(selector);

               selector->UseModel(0);
            }
         }

         int   mins[2]     = { 0, 0 };
         float weights[2]  = { 1, 1 };

         main_win = new ActiveWindow(screen, 0, 0, w, h, 100, 0);
         main_win->UseLayout(2, 2, mins, mins, weights, weights);
         main_win->SetBackColor(Color::Gray);

         screen->AddWindow(main_win);

         DWORD view_types[] = { 
            ModelView::VIEW_PLAN,
            ModelView::VIEW_PROJECT,
            ModelView::VIEW_SIDE,
            ModelView::VIEW_FRONT
         };

         for (int row = 0; row < 2; row++) {
            for (int col = 0; col < 2; col++) {
               int index = 2*row + col;

               ActiveWindow* win = new ActiveWindow(screen, 
                                                    col*w/2, 
                                                    row*h/2, 
                                                    w/2, 
                                                    h/2, 
                                                    101+index, 
                                                    WIN_BLACK_FRAME, 
                                                    main_win);

               win->SetCells(col, row, 1, 1);
               win->SetCellInsets(Insets(1,1,1,1));
               win->SetBackColor(Color(160,160,160));

               ModelView* mv = new ModelView(win, scene, view_types[index]);

               if (view_types[index] == ModelView::VIEW_PROJECT)
                  mv->SetFillMode(ModelView::FILL_TEXTURE);

               mv->UseGrid(grid);
               win->AddView(mv);

               view_win[index]   = win;
               model_view[index] = mv;
            }
         }

         view_win[0]->SetStyle(WIN_WHITE_FRAME);

         uvmap_win  = new ActiveWindow(screen, 0, 0, w, h, 110, WIN_BLACK_FRAME, main_win);
         uvmap_view = new UVMapView(uvmap_win);
         uvmap_win->AddView(uvmap_view);

         main_win->DoLayout();
      }

      else {
         ::Print("  Could not establish requested video parameters.\n");
         ::Print("  -----------------------------------------------\n\n");
      }
   }
}