<commit_before>/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 <NAME> 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/
#if defined(_MSC_VER)
    #pragma warning( disable : 4786 )
#endif

#include <stdio.h>
#include <math.h>
#include <float.h>

#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/AlphaFunc>
#include <osg/Notify>

#include <osgSim/ImpostorSprite>

using namespace osg;
using namespace osgSim;

ImpostorSprite::ImpostorSprite()
{
    // don't use display list since we will be updating the geometry.
    _useDisplayList = false;
    _parent = NULL;
    
    _ism = NULL;
    _previous = NULL;
    _next = NULL;

    _lastFrameUsed = osg::UNINITIALIZED_FRAME_NUMBER;
    
    _texture = NULL;
    _s = 0;
    _t = 0;        

    _color.set(1.0f, 1.0f, 1.0f, 1.0f );
}

ImpostorSprite::ImpostorSprite(const ImpostorSprite&): Drawable() {}


ImpostorSprite::~ImpostorSprite()
{
    if (_ism)
    {
        _ism->remove(this);
    }
}

float ImpostorSprite::calcPixelError(const osg::Matrix& MVPW) const
{
    // find the maximum screen space pixel error between the control coords and the quad coners.
    float max_error_sqrd = 0.0f;

    for(int i=0;i<4;++i)
    {

        osg::Vec3 projected_coord = _coords[i]*MVPW;
        osg::Vec3 projected_control = _controlcoords[i]*MVPW;<commit_msg>Fixed Coverity reported issue.<commit_after>/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 <NAME> 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/
#if defined(_MSC_VER)
    #pragma warning( disable : 4786 )
#endif

#include <stdio.h>
#include <math.h>
#include <float.h>

#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osg/AlphaFunc>
#include <osg/Notify>

#include <osgSim/ImpostorSprite>

using namespace osg;
using namespace osgSim;

ImpostorSprite::ImpostorSprite():
    _parent(0),
    _ism(0),
    _previous(0),
    _next(0),
    _lastFrameUsed(osg::UNINITIALIZED_FRAME_NUMBER),
    _texture(0),
    _s(0),
    _t(0)
{
    // don't use display list since we will be updating the geometry.
    setUseDisplayList(false);
    _color.set(1.0f, 1.0f, 1.0f, 1.0f );
}

ImpostorSprite::ImpostorSprite(const ImpostorSprite&):
    osg::Drawable(),
    _parent(0),
    _ism(0),
    _previous(0),
    _next(0),
    _lastFrameUsed(osg::UNINITIALIZED_FRAME_NUMBER),
    _texture(0),
    _s(0),
    _t(0)
{
    setUseDisplayList(false);
    _color.set(1.0f, 1.0f, 1.0f, 1.0f );
}

ImpostorSprite::~ImpostorSprite()
{
    if (_ism)
    {
        _ism->remove(this);
    }
}

float ImpostorSprite::calcPixelError(const osg::Matrix& MVPW) const
{
    // find the maximum screen space pixel error between the control coords and the quad coners.
    float max_error_sqrd = 0.0f;

    for(int i=0;i<4;++i)
    {

        osg::Vec3 projected_coord = _coords[i]*MVPW;
        osg::Vec3 projected_control = _controlcoords[i]*MVPW;
{'fraction_non_alphanumeric': 0.11235383833248602, 'fraction_numerical': 0.020843924758515507, 'mean_word_length': 3.5755813953488373, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4772265', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1353, 'n_words': 390}