/[libvob]/libvob/include/vob/Vob.hxx
ViewVC logotype

Diff of /libvob/include/vob/Vob.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by tjl, Sun Mar 16 17:58:49 2003 UTC revision 1.7 by tjl, Sun Mar 23 20:15:58 2003 UTC
# Line 29  Vob.hxx Line 29  Vob.hxx
29    
30  #include <vob/Transform.hxx>  #include <vob/Transform.hxx>
31    
32    /** The main namespace for libvob.
33     * All libvob symbols are placed in this namespace.
34     */
35  namespace Vob {  namespace Vob {
36    
37      struct Vob {      /** A vob: an object that knows how to render itself,
38         * given a number of coordinate transforms.
39         */
40        class Vob {
41        public:
42          virtual ~Vob() { }          virtual ~Vob() { }
43            /** Get the number of transforms this Vob's render() call
44             * requires.
45             */
46          virtual int nCoordsys() const = 0;          virtual int nCoordsys() const = 0;
47            /** Render this Vob, given a number of transforms.
48             * @param t The transforms
49             * @param n The number of transforms in t.
50             */
51          virtual void render(const Transform **t, int n) const = 0;          virtual void render(const Transform **t, int n) const = 0;
52      };      };
53    
54      struct Vob0 {      /** A vob which uses no coordinate systems. A specialization
55         * of Vob for efficiency.
56         */
57        class Vob0 : public Vob {
58        public:
59          virtual ~Vob0() {}          virtual ~Vob0() {}
60          virtual int nCoordsys() const { return 0; };          virtual int nCoordsys() const { return 0; };
61          virtual void render(const Transform **t, int n) const { render0(); }          virtual void render(const Transform **t, int n) const { render0(); }
# Line 45  namespace Vob { Line 63  namespace Vob {
63      };      };
64    
65    
66      struct Vob1 {      /** A vob which uses one coordinate system. A specialization
67         * of Vob for efficiency.
68         */
69        class Vob1 : public Vob {
70        public:
71          virtual ~Vob1() {}          virtual ~Vob1() {}
72          virtual int nCoordsys() const { return 1; };          virtual int nCoordsys() const { return 1; };
73          virtual void render(const Transform **t, int n) const { render1(*(t[0])); }          virtual void render(const Transform **t, int n) const { render1(*(t[0])); }
74          virtual void render1(const Transform &t) const = 0;          virtual void render1(const Transform &t) const = 0;
75      };      };
76    
77      struct Vob2 {      /** A vob which uses two coordinate systems. A specialization
78         * of Vob for efficiency.
79         */
80        class Vob2 : public Vob {
81        public:
82          virtual ~Vob2() {}          virtual ~Vob2() {}
83          virtual int nCoordsys() const { return 2; };          virtual int nCoordsys() const { return 2; };
84          virtual void render(const Transform **t, int n) const {          virtual void render(const Transform **t, int n) const {
# Line 61  namespace Vob { Line 87  namespace Vob {
87          virtual void render2(const Transform &t0, const Transform &t1) const = 0;          virtual void render2(const Transform &t0, const Transform &t1) const = 0;
88      };      };
89    
90        /** A template class which implements Vob, given a class with a render() method.
91         * Used by the code generation mechanism to decouple defining Vobs from the
92         * actual Vob interface.
93         */
94      template<class VobSeed> class Vob0Maker : public Vob0, public VobSeed {      template<class VobSeed> class Vob0Maker : public Vob0, public VobSeed {
95          virtual void render0() const {          virtual void render0() const {
96              VobSeed::render();              VobSeed::render();
97          }          }
98      };      };
99    
100        /** A template class which implements Vob, given a class with a render(t) method.
101         * Used by the code generation mechanism to decouple defining Vobs from the
102         * actual Vob interface.
103         */
104      template<class VobSeed> class Vob1Maker : public Vob1, public VobSeed {      template<class VobSeed> class Vob1Maker : public Vob1, public VobSeed {
105          virtual void render1(const Transform &t) const {          virtual void render1(const Transform &t) const {
106              VobSeed::render(t);              VobSeed::render(t);
107          }          }
108      };      };
109    
110        /** A template class which implements Vob, given a class with a render(t0, t1) method.
111         * Used by the code generation mechanism to decouple defining Vobs from the
112         * actual Vob interface.
113         */
114      template<class VobSeed> class Vob2Maker : public Vob2, public VobSeed {      template<class VobSeed> class Vob2Maker : public Vob2, public VobSeed {
115          virtual void render2(const Transform &t0, const Transform &t1) const {          virtual void render2(const Transform &t0, const Transform &t1) const {
116              VobSeed::render(t0, t1);              VobSeed::render(t0, t1);
# Line 79  namespace Vob { Line 118  namespace Vob {
118      };      };
119    
120  }  }
121    //@Include: Transform.hxx
122    //@Include: Primitives.hxx
123    //@Include: LinearPrimitives.hxx
124    //@Include: FunctionalPrimitives.hxx
125    //@Include: DisablablePrimitives.hxx
126    //
127    //@Include: util/Perlin.hxx
128    //@Include: Vec23.hxx
129    
130    
131  #endif  #endif

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26