Changeset 13041 for OpenSceneGraph/trunk/include/osg/buffered_value
- Timestamp:
- 03/21/12 18:36:20 (15 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/buffered_value (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/buffered_value
r5882 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 */ … … 22 22 /** Implements a simple buffered value for values that need to be buffered on 23 23 * a per graphics context basis. 24 */ 24 */ 25 25 template<class T> 26 26 class buffered_value 27 27 { 28 28 public: 29 29 30 30 inline buffered_value(): 31 31 _array(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0) … … 41 41 return *this; 42 42 } 43 43 44 44 inline void setAllElementsTo(const T& t) { std::fill(_array.begin(),_array.end(),t); } 45 45 … … 49 49 50 50 inline unsigned int size() const { return _array.size(); } 51 51 52 52 inline void resize(unsigned int newSize) { _array.resize(newSize,0); } 53 53 … … 71 71 72 72 protected: 73 73 74 74 mutable std::vector<T> _array; 75 75 }; … … 79 79 { 80 80 public: 81 81 82 82 inline buffered_object(): 83 83 _array(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()) … … 121 121 return _array[pos]; 122 122 } 123 123 124 124 125 125 protected: 126 126 127 127 mutable std::vector<T> _array; 128 128 };
