Hi Robert,

I'm trying to follow the dots, the first lands in the OpenFlight loader where 
the blink sequence for a strobe/rotating becon uses the color of the light 
point:

LightPointRecord.cpp: 306

                    blinkSequence->addPulse(_animation->animationEnabledPeriod, 
lp._color);

Then in the BlinkSequence:color() that same color (which is the same as the 
color of the lightpoint) is modulated the current time_delta/pulse time.  
Starting at line 160:

    osg::Vec4 color(itr->second*(itr->first-lt));
    double len = length-(itr->first-lt);
    ++itr;
    if (itr==_pulseData.end()) itr = _pulseData.begin();

    // accumulate all the whole pluses pulses.
    while (len>itr->first)
    {
        len -= itr->first;
        color += itr->second*itr->first;
        ++itr;
        if (itr==_pulseData.end()) itr = _pulseData.begin();
    }

    // add remaining part of the final pulse.
    color += itr->second*len;

    // normalise the time waited color.   
    color /= length;

    return color;

The result here is a value that transitions from pulse color to pulse color.  
In the case of a strobe or rotating beacon it is the light point color and 
black.  So, for a strobe or beacon it is the original color and black.

This value is returned and then multiplied against the original light color, 
thus it's the light color * light color.

Or  lp._color * bs::color() (where bs::color == lp._color).

What this means to me is that the blink sequence is doing all of the work of 
modulating from pulse color to pulse color, which appears correct, but the 
LightPointNode is incorrectly applying this value as a multiplier to the 
original light point color.

LightPointNode.cpp: 282

            osg::Vec4 color = lp._color;

...

LightPointNode.cpp: 297

            // check the blink sequence.
            bool doBlink = lp._blinkSequence.valid();
            if (doBlink && _lightSystem.valid())
                doBlink = (_lightSystem->getAnimationState() == 
LightPointSystem::ANIMATION_ON);

            if (doBlink)
            {
                osg::Vec4 bs = lp._blinkSequence->color(time,timeInterval);
                color[0] *= bs[0];
                color[1] *= bs[1];
                color[2] *= bs[2];
                color[3] *= bs[3];
            }


Maybe this is an issue with the OpenFlight chain, but the numbers appear to 
speak for themselves.  The color value is being squared when it's an OpenFlight 
based model that specifies a strobe or beacon.

In OpenFlight there appears to be no way to specify white for the color and 
provide a strobe or beacon color and this appears to be represented in the 
OpenFlight loader in OSG (see above).

-B


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Robert 
Osfield
Sent: Friday, June 22, 2012 11:40 AM
To: OpenSceneGraph Submissions
Subject: Re: [osg-submissions] LightPointNode.cpp:304 Incorrect application of 
blink

Hi Brad,

On 22 June 2012 18:59, Brad Colbert <[email protected]> wrote:
> Robert,
>
> ... and changing the code to color[0] = bs[0]; I get something that I would 
> expect:

It might be something that you would expect, but your expectation is
clearly off, you are expecting a colour replace rather a colour
modulate, the BlinkSequence is written to be a colour modulate.  The
original code is correct.

I can only presume that you light point colours are set to an
inappropriate value or that the blink sequence colour is an
appropriate value.  If you want colour replace style functionality
then you should use 1 1 1 1 for the light point colour.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to