Common/GL/GLFunctions.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------------
00004 //  Copyright (c) 2007 Celeritive Technologies, Inc.
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019 //
00020 //-------------------------------------------------------------------
00021 #pragma once
00022 #ifndef VOLUMILL_GLFUNCTIONS_H
00023 #define VOLUMILL_GLFUNCTIONS_H
00024 
00025 #include <Exchange/ToolpathRecords.h>
00026 #include <Geom/BoundingBox.h>
00027 
00028 namespace gl
00029 {
00030 
00031 struct SelectedCurveInfo
00032 {
00033    int m_recordIdx;
00034    int m_type;
00035    geom::Point3d m_startPt, m_endPt;
00036    double m_radius;
00037    double m_feedrate;
00038 };
00039 
00040 struct BoundingBoxComputer : public boost::static_visitor<void>
00041 {
00042    BoundingBoxComputer ()
00043    {
00044    }
00045    void operator() (const exchange::RapidMove& rm)
00046    {
00047       m_bbox.addPoint (rm.m_endPt);
00048    }
00049    void operator() (const exchange::LinearMove& lm)
00050    {
00051       m_bbox.addPoint (lm.m_endPt);
00052    }
00053    void operator() (const exchange::ArcCW& cwArc)
00054    {
00055       m_bbox.addPoint (cwArc.m_endPt);
00056    }
00057    void operator() (const exchange::ArcCCW& ccwArc)
00058    {
00059       m_bbox.addPoint (ccwArc.m_endPt);
00060    }
00061    void operator() (const exchange::FeedRate& fr)
00062    {
00063    }
00064    void operator() (const exchange::Warning& w)
00065    {
00066    }
00067    void operator() (const exchange::CustomRecord&)
00068    {
00069    }
00070    geom::BoundingBox3d m_bbox;
00071 };
00072 
00073 struct DisplayListWriter : public boost::static_visitor<void>
00074 {
00075    DisplayListWriter (const geom::Point3d& lastPt, double rapidZ, double zOffset,
00076       double tol, int level, std::pair<int, int> selection,
00077       std::vector<geom::Point3d>* pTessPts, SelectedCurveInfo* pSelectedCurveInfo)
00078          : m_lastPt (lastPt), m_lastFeedrate (0.0), m_rapidZ (rapidZ), m_zOffset (zOffset),
00079          m_tol (tol), m_level (level), m_selection (selection), m_idx (0), m_pTessPts (pTessPts),
00080          m_pSelectedCurveInfo (pSelectedCurveInfo)
00081    {
00082    }
00083    void tessellateArc (const geom::Point3d& startPt, const geom::Point3d& endPt, double radius, bool isCCW);
00084    void setRapidColor();
00085    void setCutColor();
00086    void operator() (const exchange::RapidMove& rm);
00087    void operator() (const exchange::LinearMove& lm);
00088    void operator() (const exchange::ArcCW& cwArc);
00089    void operator() (const exchange::ArcCCW& ccwArc);
00090    void operator() (const exchange::FeedRate& fr);
00091    void operator() (const exchange::Warning& w);
00092    void operator() (const exchange::CustomRecord&);
00093 
00094    geom::Point3d m_lastPt;
00095    double m_lastFeedrate;
00096    bool m_isRapid;
00097 
00098    double m_rapidZ;
00099    double m_zOffset;
00100    double m_tol;
00101    std::pair<int, int> m_selection;
00102    int m_level;
00103    int m_idx;
00104    std::vector<geom::Point3d>* m_pTessPts;
00105    SelectedCurveInfo* m_pSelectedCurveInfo;
00106 };
00107 
00108 }
00109 
00110 #endif

Generated on Tue Jan 29 21:37:56 2008 for VoluMill Universal Client by  doxygen 1.4.6