summaryrefslogtreecommitdiffhomepage
path: root/Magic2/Selection.h
blob: 3fe186c922dccb278bb6d26f4e5412b90b5bb289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.

    AUTHOR:       John DiCamillo


    OVERVIEW
    ========
    Classes for rendering solid meshes of polygons
*/

#ifndef Selection_h
#define Selection_h

#include <vector>
#include "Polygon.h"
#include "Graphic.h"
#include "Video.h"
#include "List.h"

// +--------------------------------------------------------------------+

class Selection;
class Solid;
class Model;
class ModelView;
class Surface;
class Segment;

// +--------------------------------------------------------------------+

class Selection : public Graphic
{
public:
   static const char* TYPENAME() { return "Selection"; }

   Selection();
   virtual ~Selection();

   // operations
   virtual void   Render(Video* video, DWORD flags);
   virtual bool   CheckVisibility(Projector& projector) { return true; }

   // accessors / mutators
   void           UseModel(Model* m)   { model = m;      }
   void           UseView(ModelView* v){ model_view = v; }
   Model*         GetModel()     const { return model;   }
   List<Poly>&    GetPolys()           { return polys;   }
   std::vector<DWORD>&     GetVerts()  { return verts;   }

   virtual void   Clear()              { polys.clear();
                                         verts.clear();  }

   void           AddPoly(Poly* p);
   void           AddVert(WORD s, WORD v);
   void           RemovePoly(Poly* p);
   void           RemoveVert(WORD s, WORD v);
   bool           Contains(Poly* p)          const;
   bool           Contains(WORD s, WORD v)   const;

protected:
   Model*         model;
   ModelView*     model_view;
   List<Poly>     polys;
   std::vector<DWORD> verts;
};

// +--------------------------------------------------------------------+

#endif Selection_h