My Project
 All Classes Files Functions Variables Enumerations Pages
scan.h
Go to the documentation of this file.
1 /**************************************************************************/
2 /* Copyright 2009 Tim Day */
3 /* */
4 /* This file is part of Fracplanet */
5 /* */
6 /* Fracplanet is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* Fracplanet is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with Fracplanet. If not, see <http://www.gnu.org/licenses/>. */
18 /**************************************************************************/
19 
24 #ifndef _scan_h_
25 #define _scan_h_
26 
27 #include "xyz.h"
28 
30 
33 class ScanEdge
34 {
35  public:
36 
37  ScanEdge()
38  {}
39 
40  ScanEdge(float vx,uint v0,uint v1,float l)
41  :x(vx)
42  ,vertex0(v0)
43  ,vertex1(v1)
44  ,lambda(l)
45  {}
46 
47  float x;
48  uint vertex0;
49  uint vertex1;
50  float lambda;
51 };
52 
53 class ScanConvertBackend;
54 
56 {
57  public:
58 
60  {}
61 
62  virtual ~ScanConverter()
63  {}
64 
66  /* Scan conversion output is a series of [,) open intervals with vertex identifiers and weightings for each end.
67  */
68  virtual void scan_convert
69  (
70  const boost::array<XYZ,3>& v,
71  const ScanConvertBackend&
72  ) const
73  =0;
74 };
75 
77 {
78  public:
79 
80  ScanConvertBackend(int w,int h)
81  :_width(w)
82  ,_height(h)
83  {}
84 
85  virtual ~ScanConvertBackend()
86  {}
87 
88  int width() const
89  {
90  return _width;
91  }
92 
93  int height() const
94  {
95  return _height;
96  }
97 
98  virtual void scan_convert_backend(uint y,const ScanEdge& edge0,const ScanEdge& edge1) const
99  =0;
100 
101  virtual void subdivide(const boost::array<XYZ,3>&,const XYZ&,const ScanConverter&) const
102  =0;
103 
104  private:
105 
106  const int _width;
107 
108  const int _height;
109 };
110 
111 #endif
Interface for class XYZ.
virtual void scan_convert(const boost::array< XYZ, 3 > &v, const ScanConvertBackend &) const =0
Set-up for scan conversion of given vertices to the given map.
Class to hold vectors in 3D cartesian co-ordinates.
Definition: xyz.h:34
Definition: scan.h:76
Definition: scan.h:55
Encapsulates information needed for scan conversion.
Definition: scan.h:33