| 111 | static osg::Node* CreateBlinkSequenceLightNode() |

| 112 | { |

| 113 | osgSim::LightPointNode* lightPointNode = new osgSim::LightPointNode;; |

| 114 | |

| 115 | osgSim::LightPointNode::LightPointList lpList; |

| 116 | |

| 117 | osg::ref_ptr<osgSim::SequenceGroup> seq_0; |

| 118 | seq_0 = new osgSim::SequenceGroup; |

| 119 | seq_0->_baseTime = 0.0; |

| 120 | |

| 121 | osg::ref_ptr<osgSim::SequenceGroup> seq_1; |

| 122 | seq_1 = new osgSim::SequenceGroup; |

| 123 | seq_1->_baseTime = 0.5; |

| 124 | |

| 125 | const int max_points = 32; |

| 126 | for( int i = 0; i < max_points; ++i ) |

| 127 | { |

| 128 | osgSim::LightPoint lp; |

| 129 | double x = cos( (2.0*osg::PI*i)/max_points ); |

| 130 | double z = sin( (2.0*osg::PI*i)/max_points ); |

| 131 | lp._position.set( x, 0.0f, z + 100.0f ); |

| 132 | lp._blinkSequence = new osgSim::BlinkSequence; |

| 133 | for( int j = 10; j > 0; --j ) |

| 134 | { |

| 135 | float intensity = j/10.0f; |

| 136 | lp._blinkSequence->addPulse( 1.0/max_points, |

| 137 | osg::Vec4( intensity, intensity, intensity, intensity ) ); |

| 138 | } |

| 139 | if( max_points > 10 ) |

| 140 | { |

| 141 | lp._blinkSequence->addPulse( 1.0 - 10.0/max_points, |

| 142 | osg::Vec4( 0.0f, 0.0f, 0.0f, 0.0f ) ); |

| 143 | } |

| 144 | |

| 145 | if( i & 1 ) |

| 146 | { |

| 147 | lp._blinkSequence->setSequenceGroup( seq_1.get() ); |

| 148 | } |

| 149 | else |

| 150 | { |

| 151 | lp._blinkSequence->setSequenceGroup( seq_0.get() ); |

| 152 | } |

| 153 | lp._blinkSequence->setPhaseShift( i/(static_cast<double>(max_points)) ); |

| 154 | lpList.push_back( lp ); |

| 155 | } |

| 156 | |

| 157 | lightPointNode->setLightPointList( lpList ); |

| 158 | |

| 159 | return lightPointNode; |

| 160 | } |