Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52183 - in sandbox-branches/andreo/guigl: boost/guigl libs/guigl/build/vc8ide libs/guigl/example
From: andreytorba_at_[hidden]
Date: 2009-04-05 07:37:58


Author: andreo
Date: 2009-04-05 07:37:57 EDT (Sun, 05 Apr 2009)
New Revision: 52183
URL: http://svn.boost.org/trac/boost/changeset/52183

Log:
added dimension_dispatch in ggl.hpp, deleted autogeo project
Text files modified:
   sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp | 399 ++++++++++++++++++++-------------------
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj | 8
   sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln | 6
   sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile | 2
   4 files changed, 214 insertions(+), 201 deletions(-)

Modified: sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp
==============================================================================
--- sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp (original)
+++ sandbox-branches/andreo/guigl/boost/guigl/ggl.hpp 2009-04-05 07:37:57 EDT (Sun, 05 Apr 2009)
@@ -92,63 +92,21 @@
 
 namespace boost{ namespace guigl { namespace ggl {
 
- template<class T>
- inline
- BOOST_CONCEPT_REQUIRES(((geometry::ConstBox<T>)),
- (void))
- rect(T const& g)
+ template<class T>
+ inline
+ BOOST_CONCEPT_REQUIRES(((geometry::ConstBox<T>)),
+ (void))
+ rect(T const& g)
     {
- gl::rect(
- geometry::get<geometry::min_corner, 0>(g),
- geometry::get<geometry::min_corner, 1>(g),
- geometry::get<geometry::max_corner, 0>(g),
- geometry::get<geometry::max_corner, 1>(g));
+ gl::rect(
+ geometry::get<geometry::min_corner, 0>(g),
+ geometry::get<geometry::min_corner, 1>(g),
+ geometry::get<geometry::max_corner, 0>(g),
+ geometry::get<geometry::max_corner, 1>(g));
     }
 
     namespace dispatch
     {
- template<int N>
- struct pvertex_;
-
- template<>
- struct pvertex_<2>
- {
- template<typename G>
- inline void operator()(G const& g)
- {
- boost::guigl::gl::vertex(
- geometry::get<0>(g),
- geometry::get<1>(g));
- }
- };
-
- template<>
- struct pvertex_<3>
- {
- template<typename G>
- inline void operator()(G const& g)
- {
- boost::guigl::gl::vertex(
- geometry::get<0>(g),
- geometry::get<1>(g),
- geometry::get<2>(g));
- }
- };
-
- template<>
- struct pvertex_<4>
- {
- template<typename G>
- inline void operator()(G const& g)
- {
- boost::guigl::gl::vertex(
- geometry::get<0>(g),
- geometry::get<1>(g),
- geometry::get<2>(g),
- geometry::get<3>(g));
- }
- };
-
         template <typename Tag, typename G>
         struct object_tag
         {
@@ -161,13 +119,56 @@
         template<typename G>
         struct object_tag<geometry::point_tag, G>
         {
+ private:
+ template<int N>
+ struct dimension_dispatch;
+
+ template<>
+ struct dimension_dispatch<2>
+ {
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0>(g),
+ geometry::get<1>(g));
+ }
+ };
+
+ template<>
+ struct dimension_dispatch<3>
+ {
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0>(g),
+ geometry::get<1>(g),
+ geometry::get<2>(g));
+ }
+ };
+
+ template<>
+ struct dimension_dispatch<4>
+ {
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0>(g),
+ geometry::get<1>(g),
+ geometry::get<2>(g),
+ geometry::get<3>(g));
+ }
+ };
+
+
         public:
             static inline
                 BOOST_CONCEPT_REQUIRES(((geometry::ConstPoint<G>)),
                 (void))
                 vertex(G const& g)
             {
- pvertex_<geometry::traits::dimension<G>::value>()(g);
+ dimension_dispatch<
+ geometry::traits::dimension<G>::value
+ >::vertex(g);
             }
 
             static inline
@@ -199,150 +200,153 @@
         void operator()(G const& g) const {vertex(g);}
     };
 
- template<class Point>
- class tess : public boost::guigl::gl::tess
+ template<class Point>
+ class tess : public boost::guigl::gl::tess
     {
     public:
- typedef boost::guigl::gl::tess base_type;
- typedef Point point_type;
+ typedef boost::guigl::gl::tess base_type;
+ typedef Point point_type;
 
     private:
 
- static void CALLBACK begin_cb(GLenum which)
+ static void CALLBACK begin_cb(GLenum which)
         {
- glBegin(which);
+ glBegin(which);
         }
 
- static void CALLBACK end_cb()
+ static void CALLBACK end_cb()
         {
- glEnd();
+ glEnd();
         }
- static void CALLBACK vertex_cb(const GLvoid *data)
+ static void CALLBACK vertex_cb(const GLvoid *data)
         {
- point_type const& pt =
- *((point_type const*)data);
+ point_type const& pt =
+ *((point_type const*)data);
 
- boost::guigl::ggl::vertex(pt);
+ boost::guigl::ggl::vertex(pt);
         }
 
- static void CALLBACK error_cb(GLenum error_code)
+ static void CALLBACK error_cb(GLenum error_code)
         {
- BOOST_ASSERT(!gluGetString(error_code));
+ BOOST_ASSERT(!gluGetString(error_code));
         }
 
     public:
- tess() {
- if(base_type::operator !())
- throw std::runtime_error("invalid tess");
-
- begin_callback(begin_cb);
- end_callback(end_cb);
- vertex_callback(vertex_cb);
- error_callback(error_cb);
+ tess() {
+ if(base_type::operator !())
+ throw std::runtime_error("invalid tess");
+
+ begin_callback(begin_cb);
+ end_callback(end_cb);
+ vertex_callback(vertex_cb);
+ error_callback(error_cb);
         }
 
- class contour : public base_type::contour
+ class contour : public base_type::contour
         {
         private:
 
- inline void init_coordinates(double coord[3], point_type const& pt, boost::mpl::int_<2>)
+ inline void init_coordinates(double coord[3], point_type const& pt, boost::mpl::int_<2>)
             {
- coord[0] = geometry::get<0>(pt);
- coord[1] = geometry::get<1>(pt);
- coord[2] = 0.0;
+ coord[0] = geometry::get<0>(pt);
+ coord[1] = geometry::get<1>(pt);
+ coord[2] = 0.0;
             }
 
- inline void init_coordinates(double coord[3], point_type const& pt, boost::mpl::int_<3>)
+ inline void init_coordinates(double coord[3], point_type const& pt, boost::mpl::int_<3>)
             {
- coord[0] = geometry::get<0>(pt);
- coord[1] = geometry::get<1>(pt);
- coord[2] = geometry::get<2>(pt);
+ coord[0] = geometry::get<0>(pt);
+ coord[1] = geometry::get<1>(pt);
+ coord[2] = geometry::get<2>(pt);
             }
 
         public:
- inline explicit contour(polygon const& pg)
- : base_type::contour(pg) {}
+ inline explicit contour(polygon const& pg)
+ : base_type::contour(pg) {}
 
- inline void operator()(point_type const& pt)
+ inline void operator()(point_type const& pt)
             {
- double coord[3];
- init_coordinates(coord, pt, geometry::dimension<point_type>());
- base_type::contour::operator()(coord, (void*)&pt);
+ double coord[3];
+ init_coordinates(coord, pt, geometry::dimension<point_type>());
+ base_type::contour::operator()(coord, (void*)&pt);
             }
-
+
         };
     };
 
     namespace dispatch
     {
- template<int N>
- struct svertex_;
-
- template<>
- struct svertex_<2>
- {
- template<typename G>
- inline void operator()(G const& g)
- {
- boost::guigl::gl::vertex(
- geometry::get<0, 0>(g),
- geometry::get<0, 1>(g));
- boost::guigl::gl::vertex(
- geometry::get<1, 0>(g),
- geometry::get<1, 1>(g));
- }
- };
-
- template<>
- struct svertex_<3>
+ ////////////////////////////////////////////////////////////////////////////////
+ // Segment
+ template<typename G>
+ struct object_tag<geometry::segment_tag, G>
         {
- template<typename G>
- inline void operator()(G const& g)
+ private:
+
+ template<int N>
+ struct dimension_dispatch;
+
+ template<>
+ struct dimension_dispatch<2>
             {
- boost::guigl::gl::vertex(
- geometry::get<0, 0>(g),
- geometry::get<0, 1>(g),
- geometry::get<0, 2>(g));
- boost::guigl::gl::vertex(
- geometry::get<1, 0>(g),
- geometry::get<1, 1>(g),
- geometry::get<1, 2>(g));
- }
- };
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0, 0>(g),
+ geometry::get<0, 1>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<1, 0>(g),
+ geometry::get<1, 1>(g));
+ }
+ };
 
- template<>
- struct svertex_<4>
- {
- template<typename G>
- inline void operator()(G const& g)
+ template<>
+ struct dimension_dispatch<3>
             {
- boost::guigl::gl::vertex(
- geometry::get<0, 0>(g),
- geometry::get<0, 1>(g),
- geometry::get<0, 2>(g),
- geometry::get<0, 3>(g));
- boost::guigl::gl::vertex(
- geometry::get<1, 0>(g),
- geometry::get<1, 1>(g),
- geometry::get<1, 2>(g),
- geometry::get<1, 3>(g));
- }
- };
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0, 0>(g),
+ geometry::get<0, 1>(g),
+ geometry::get<0, 2>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<1, 0>(g),
+ geometry::get<1, 1>(g),
+ geometry::get<1, 2>(g));
+ }
+ };
 
+ template<>
+ struct dimension_dispatch<4>
+ {
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<0, 0>(g),
+ geometry::get<0, 1>(g),
+ geometry::get<0, 2>(g),
+ geometry::get<0, 3>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<1, 0>(g),
+ geometry::get<1, 1>(g),
+ geometry::get<1, 2>(g),
+ geometry::get<1, 3>(g));
+ }
+ };
 
- ////////////////////////////////////////////////////////////////////////////////
- // Segment
- template<typename G>
- struct object_tag<geometry::segment_tag, G>
- {
         public:
             static inline
                 BOOST_CONCEPT_REQUIRES(((geometry::ConstSegment<G>)),
                 (void))
                 vertex(G const& g)
             {
- typedef typename geometry::traits::point_type<G>::type point_type;
- svertex_<geometry::traits::dimension<point_type>::value>()(g);
+ typedef
+ typename geometry::traits::point_type<G>::type
+ point_type;
+
+ dimension_dispatch<
+ geometry::traits::dimension<point_type>::value
+ >::vertex(g);
             }
 
             static inline
@@ -356,36 +360,37 @@
             }
         };
 
- template<int N>
- struct bvertex_;
-
- template<>
- struct bvertex_<2>
- {
- template<typename G>
- inline void operator()(G const& g)
- {
- boost::guigl::gl::vertex(
- geometry::get<geometry::min_corner, 0>(g),
- geometry::get<geometry::min_corner, 1>(g));
- boost::guigl::gl::vertex(
- geometry::get<geometry::min_corner, 0>(g),
- geometry::get<geometry::max_corner, 1>(g));
- boost::guigl::gl::vertex(
- geometry::get<geometry::max_corner, 0>(g),
- geometry::get<geometry::max_corner, 1>(g));
- boost::guigl::gl::vertex(
- geometry::get<geometry::max_corner, 0>(g),
- geometry::get<geometry::min_corner, 1>(g));
- }
- };
-
         ////////////////////////////////////////////////////////////////////////////////
         // Box
         template<typename G>
         struct object_tag<geometry::box_tag, G>
         {
+ private:
+ template<int N>
+ struct dimension_dispatch;
+
+ template<>
+ struct dimension_dispatch<2>
+ {
+ static inline void vertex(G const& g)
+ {
+ boost::guigl::gl::vertex(
+ geometry::get<geometry::min_corner, 0>(g),
+ geometry::get<geometry::min_corner, 1>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<geometry::min_corner, 0>(g),
+ geometry::get<geometry::max_corner, 1>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<geometry::max_corner, 0>(g),
+ geometry::get<geometry::max_corner, 1>(g));
+ boost::guigl::gl::vertex(
+ geometry::get<geometry::max_corner, 0>(g),
+ geometry::get<geometry::min_corner, 1>(g));
+ }
+ };
+
             // support for 3d
+ // ...
 
         public:
             static inline
@@ -393,8 +398,12 @@
                 (void))
                 vertex(G const& g)
             {
- typedef typename geometry::traits::point_type<G>::type point_type;
- bvertex_<geometry::traits::dimension<point_type>::value>()(g);
+ typedef
+ typename geometry::traits::point_type<G>::type
+ point_type;
+ dimension_dispatch<
+ geometry::traits::dimension<point_type>::value
+ >::vertex(g);
             }
 
             static inline
@@ -462,7 +471,7 @@
                 (void))
                 vertex(G const& g)
             {
- geometry::for_each_point(g, vertex_drawer());
+ geometry::for_each_point(g, vertex_drawer());
             }
 
             static inline
@@ -470,28 +479,28 @@
                 (void))
                 draw(G const& g)
             {
- typedef
- typename geometry::point_type<G>::type
- point_type;
- typedef
- typename geometry::ring_type<G>::type
- ring_type;
- typedef
- ::boost::guigl::ggl::tess<point_type>
- tess_type;
-
- tess_type t;
- typename tess_type::polygon p(t);
- {
- typename tess_type::contour c(p);
- BOOST_FOREACH(point_type const& pt, geometry::exterior_ring(g))
- c(pt);
- }
- BOOST_FOREACH(ring_type const& ring, geometry::interior_rings(g))
+ typedef
+ typename geometry::point_type<G>::type
+ point_type;
+ typedef
+ typename geometry::ring_type<G>::type
+ ring_type;
+ typedef
+ ::boost::guigl::ggl::tess<point_type>
+ tess_type;
+
+ tess_type t;
+ typename tess_type::polygon p(t);
+ {
+ typename tess_type::contour c(p);
+ BOOST_FOREACH(point_type const& pt, geometry::exterior_ring(g))
+ c(pt);
+ }
+ BOOST_FOREACH(ring_type const& ring, geometry::interior_rings(g))
                 {
- typename tess_type::contour c(p);
- BOOST_FOREACH(point_type const& pt, ring)
- c(pt);
+ typename tess_type::contour c(p);
+ BOOST_FOREACH(point_type const& pt, ring)
+ c(pt);
                 }
             }
         };

Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/example.vcproj 2009-04-05 07:37:57 EDT (Sun, 05 Apr 2009)
@@ -59,6 +59,14 @@
         </References>
         <Files>
                 <File
+ RelativePath="..\..\example\ball.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\example\ball.hpp"
+ >
+ </File>
+ <File
                         RelativePath="..\..\example\custom_example.cpp"
>
                 </File>

Modified: sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/build/vc8ide/guigl.sln 2009-04-05 07:37:57 EDT (Sun, 05 Apr 2009)
@@ -8,8 +8,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{A3977511-76A6-42A1-B6E4-917905E23ABA}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "autogeo", "autogeo.vcproj", "{AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}"
-EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 debug|Win32 = debug|Win32
@@ -32,10 +30,6 @@
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.debug|Win32.Build.0 = debug|Win32
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.release|Win32.ActiveCfg = release|Win32
                 {A3977511-76A6-42A1-B6E4-917905E23ABA}.release|Win32.Build.0 = release|Win32
- {AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.debug|Win32.ActiveCfg = debug|Win32
- {AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.debug|Win32.Build.0 = debug|Win32
- {AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.release|Win32.ActiveCfg = release|Win32
- {AC3E72D9-A1F8-4D85-B040-6C021CE9CAB7}.release|Win32.Build.0 = release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile
==============================================================================
--- sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile (original)
+++ sandbox-branches/andreo/guigl/libs/guigl/example/Jamfile 2009-04-05 07:37:57 EDT (Sun, 05 Apr 2009)
@@ -32,6 +32,7 @@
 exe sexy_button : sexy_button.cpp pch ;
 exe ggl : ggl.cpp pch ;
 exe polygon : polygon.cpp pch ;
+# exe ball : ball.cpp pch ;
 
 install window_example_stage
     :
@@ -41,6 +42,7 @@
         overlapping_example
         sexy_button
         ggl
+# ball
          polygon
     :
         <install-dependencies>on


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk