00001 /**************************************************************************** 00002 Copyright (C)2002 David Jung <opensim@pobox.com> 00003 00004 This program/file is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. (http://www.gnu.org) 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: VisualPath 1030 2004-02-11 20:46:17Z jungd $ 00019 $Revision: 1.2 $ 00020 $Date: 2004-02-11 15:46:17 -0500 (Wed, 11 Feb 2004) $ 00021 $Author: jungd $ 00022 00023 ****************************************************************************/ 00024 00025 #ifndef _GFX_VISUALPATH_ 00026 #define _GFX_VISUALPATH_ 00027 00028 #include <gfx/gfx> 00029 00030 #include <base/Path> 00031 #include <gfx/Visual> 00032 00033 #include <osg/Node> 00034 00035 00036 namespace gfx { 00037 00038 00039 class VisualPath : public base::Path, public Visual 00040 { 00041 public: 00042 /// default path - all points are 0 00043 VisualPath() 00044 : Path() {} 00045 00046 VisualPath(const Path& p) 00047 : Path(p) {} 00048 00049 /// simple line segment start[position|orientation] - end[position|orientation] 00050 VisualPath(const base::Point3& sp, const base::Orient& so, const base::Point3& ep, const base::Orient& eo) 00051 : Path(sp,so,ep,eo) {} 00052 00053 /// a set of 'waypoints' - actually points and their corresponding orientations 00054 VisualPath(const array<base::Point3>& points, const array<base::Orient>& orients = array<base::Orient>()) 00055 : Path(points, orients) {} 00056 00057 /// a set of 'waypoints'. If vector dim is 3, specifies position only; dim 6, specifies 00058 /// position and orientation using the EulerRPY (roll, pitch, yaw) convention; dim 7 00059 /// specifies position and orientation as a quaternion qx,qy,qz,qw. 00060 VisualPath(const array<base::Vector>& points) 00061 : Path(points) {} 00062 00063 /// arbitrary path defined by symbolic expressions for x,y,z,qx,qy,qz,qw in terms of s 00064 VisualPath(const base::ExpressionVector& p) 00065 : Path(p) {} 00066 00067 virtual String className() const { return String("VisualPath"); } 00068 00069 00070 virtual bool visualTypeSupported(VisualType type) const { return OSGVisual; } 00071 00072 virtual osg::Node* createOSGVisual(Attributes visualAttributes=0) const; 00073 00074 private: 00075 mutable Visual::Attributes attributes; 00076 mutable ref_ptr<osg::Node> node; 00077 00078 }; 00079 00080 00081 } // gfx 00082 00083 #endif