vrecko
virtual reality framework
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
GradientColorGen.h
Go to the documentation of this file.
1
#pragma once
2
#include "ColorGen.h"
3
4
class
GradientColorGen
:
public
ColorGen
5
{
6
public
:
7
GradientColorGen
() :
_colorStart
(osg::Vec4(1,1,1,1)),
_colorEnd
(osg::Vec4(1,1,1,1)) {}
8
GradientColorGen
(
const
osg::Vec4& colorStart,
const
osg::Vec4& colorEnd)
9
:
_colorStart
(colorStart),
_colorEnd
(colorEnd) {}
10
11
META_DAObject
(
GradientColorGen
,
"Gradient Brush"
)
12
13
14
virtual
Vec4ArrayPtr
getColors(
unsigned
int
leadSplineSize,
unsigned
int
crossSectionSize
)
15
{
16
_dirty =
false
;
17
18
Vec4ArrayPtr
result
=
new
osg::Vec4Array;
19
unsigned
int
arraySize
= leadSplineSize *
crossSectionSize
;
20
result->reserve(arraySize);
21
22
osg::Vec4
gradientStep
= (
_colorEnd
-
_colorStart
) / (
double
)leadSplineSize;
23
osg::Vec4
actualColor
;
24
25
for
(
unsigned
int
i = 0; i < leadSplineSize; i++)
26
{
27
actualColor =
_colorStart
+ gradientStep * i;
28
for
(
unsigned
int
j = 0; j <
crossSectionSize
; j++)
29
{
30
result->push_back(actualColor);
31
}
32
}
33
return
result
;
34
}
35
36
inline
osg::Vec4
getColorEnd
()
const
{
return
_colorEnd
; }
37
inline
void
setColorEnd
(osg::Vec4 val) { _dirty =
true
;
_colorEnd
= val; }
38
39
inline
osg::Vec4
getColorStart
()
const
{
return
_colorStart
; }
40
inline
void
setColorStart
(osg::Vec4 val) { _dirty =
true
;
_colorStart
= val; }
41
42
protected
:
43
osg::Vec4
_colorStart
;
44
osg::Vec4
_colorEnd
;
45
};
46
src
vreckoAP
DynamicArt
GradientColorGen.h
Generated on Tue Feb 19 2013 10:23:46 for vrecko by
1.8.3.1