- Timestamp:
- 03/21/12 18:36:20 (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgUtil/OperationArrayFunctor
r12139 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 28 28 { 29 29 public: 30 30 31 31 virtual void apply(osg::Array&) {} 32 32 // virtual void apply(osg::ByteArray& array) { T::process<osg::ByteArray>(array); } … … 61 61 { 62 62 template <typename ArrayType> 63 void process(ArrayType & array) 64 { 63 void process(ArrayType & array) 64 { 65 65 typedef typename ArrayType::ElementDataType ElementDataType; 66 66 67 67 ElementDataType convertedVector; 68 68 osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector); 69 69 70 70 typename ArrayType::iterator it = array.begin(); 71 71 std::advance(it, _begin); 72 72 73 73 typename ArrayType::iterator end = it; 74 74 std::advance(end, _count); 75 75 76 76 for (; it < end; ++it) 77 77 (*it) += convertedVector; … … 80 80 unsigned int _begin; 81 81 unsigned int _count; 82 82 83 83 osg::Vec3d _vector; 84 84 }; … … 88 88 { 89 89 template <typename ArrayType> 90 void process(ArrayType & array) 91 { 90 void process(ArrayType & array) 91 { 92 92 typedef typename ArrayType::ElementDataType ElementDataType; 93 93 94 94 ElementDataType convertedVector; 95 95 osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector); 96 96 97 97 typename ArrayType::iterator it = array.begin(); 98 98 std::advance(it, _begin); 99 99 100 100 typename ArrayType::iterator end = it; 101 101 std::advance(end, _count); 102 102 103 103 for (; it < end; ++it) 104 104 (*it) *= convertedVector; … … 107 107 unsigned int _begin; 108 108 unsigned int _count; 109 109 110 110 osg::Vec3d _vector; 111 111 };
