vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConstantColorGen.h
Go to the documentation of this file.
1 #pragma once
2 #include "ColorGen.h"
3 
4 class ConstantColorGen : public ColorGen
5 {
6 public:
7  ConstantColorGen() : _color(osg::Vec4(1,1,1,1)) {};
8  ConstantColorGen(const osg::Vec4& color) : _color(color) {};
9 
10  META_DAObject(ConstantColorGen, "Constant Brush")
11 
12 
13  virtual Vec4ArrayPtr getColors( unsigned int leadSplineSize, unsigned int crossSectionSize )
14  {
15  _dirty = false;
16 
17  Vec4ArrayPtr result = new osg::Vec4Array;
18  unsigned int arraySize = leadSplineSize * crossSectionSize;
19  result->reserve(arraySize);
20  result->assign(arraySize, _color);
21 
22  return result;
23  }
24 
25  inline osg::Vec4 getColorValue() const { return _color; }
26  inline void setColorValue(const osg::Vec4& val) { _dirty = true; _color = val; }
27 
28 protected:
29  osg::Vec4 _color;
30 };