<commit_before>#if defined(_MSC_VER)
    #pragma warning( disable : 4786 )
#endif

#include <stdlib.h>
#if !defined(WIN32) && !defined(macintosh)
#include <unistd.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <osg/Math>

#include <string>

#include <osgGLUT/Viewer>
#include <osgGLUT/GLUTEventAdapter>

#include <osg/Switch>
#include <osg/Billboard>
#include <osg/LOD>
#include <osg/Light>
#include <osg/LightSource>
#include <osg/Geode>
#include <osg/Group>
#include <osg/NodeVisitor>
#include <osg/LineSegment>
#include <osg/PolygonMode>
#include <osg/Texture>
#include <osg/Notify>

#include <osgDB/WriteFile>

#include <osgUtil/IntersectVisitor>
#include <osgUtil/DisplayListVisitor>
#include <osgUtil/SmoothingVisitor>
#include <osgUtil/TriStripVisitor>
#include <osgUtil/DisplayRequirementsVisitor>

#include <osgUtil/TrackballManipulator>
#include <osgUtil/FlightManipulator>
#include <osgUtil/DriveManipulator>

#include <osg/Version>
#include <osgUtil/Version>

#ifdef WIN32
#define USE_FLTK
#define USE_GLUT
#endif

#include <osgGLUT/glut>

#ifdef WIN32
#include <sys/timeb.h>
#else
#endif

#include <osg/Timer>
osg::Timer g_timer;
osg::Timer_t g_initTime;

//static GLenum polymodes [] = { GL_FILL, GL_LINE, GL_POINT };
static osg::PolygonMode::Mode polymodes [] = { osg::PolygonMode::FILL, osg::PolygonMode::LINE, osg::PolygonMode::POINT };

// forward declare functions to be used in stats.
GLuint makeRasterFont(void);
void displaytext(int x, int y, char *s);
int writePrims( const int ypos, osg::Statistics& stats);

using namespace osg;
using namespace osgUtil;
using namespace osgGLUT;



Viewer* Viewer::s_theViewer = 0;

Viewer::Viewer()
{
    s_theViewer = this;

    polymode = 0;
    texture = 1;
    backface = 1;
    lighting = 1;
    flat_shade = 0;

    _printStats = 0; // gwm change from bool was : false;

    #ifdef SGV_USE_RTFS
    fs = new RTfs( RTFS_MODE_RTC_SPIN );
    frame_rate = 16;
    fs->setUpdateRate( frame_rate );
    #endif

    _viewFrustumCullingActive = true;
    _smallFeatureCullingActive = true;

    _two_sided_lighting=0;

    _useDisplayLists = true;

    _saveFileName = "saved_model.osg";

    osg::notify(osg::INFO)<<"Scene Graph Viewer (sgv)"<< std::endl;

//    osg::notify(osg::INFO)<<"   '"<<osgGetLibraryName()<<"' Version "<<osgGetVersion()<< std::endl;
//    osg::notify(osg::INFO)<<"   '"<<osgUtilGetLibraryName()<<"' Version "<<osgUtilGetVersion()<< std::endl;

    _initialTick = _timer.tick();
    _frameTick = _initialTick;
    frRate=0; // added by gwm to display fram Rate smoothed

    _focusedViewport = 0;         // The viewport with mouse/keyboard focus
    
    
    _frameStamp = new osg::FrameStamp;
    
    _displaySettings = new osg::DisplaySettings;
}


Viewer::~Viewer()
{
}

/** read the command line string list, removing any matched control sequences.*/
void Viewer::readCommandLine(std::vector<std::string>& commandLine)
{
    _displaySettings->readCommandLine(commandLine);
}

/**
  * Configure and open the GLUT window for this Viewer
  * 
  */
bool Viewer::open()
{
    if ( getNumViewports() <= 0 ) {
        osg::notify(osg::FATAL)<<"osgGLUT::Viewer::open() called with no Viewports registered."<< std::endl;
        return false;
    }

    // Verify all viewports have an active camera manipulator 
    unsigned int index = 0;
    ViewportList::iterator itr;
    for(itr=_viewportList.begin();
        itr!=_viewportList.end();
        ++itr, ++index)
    {
        if (itr->_cameraManipList.empty())
        {
            osg::notify(osg::NOTICE)<<"osgGLUT::Viewer::open() called without any camara manipulators registered for a viewport,"<< std::endl;
            osg::notify(osg::NOTICE)<<"automatically registering trackball,flight and drive manipulators."<< std::endl;
            registerCameraManipulator(new osgUtil::TrackballManipulator, index);
            registerCameraManipulator(new osgUtil::FlightManipulator, index);<commit_msg>Made the output message related to not registering a camera manipulator with the GLUT Viewer output as INFO rather than as a NOTICE. This suppress this message which was appearing on some of the demos all the time, even though are quite reasonable default behaviour is used.<commit_after>#if defined(_MSC_VER)
    #pragma warning( disable : 4786 )
#endif

#include <stdlib.h>
#if !defined(WIN32) && !defined(macintosh)
#include <unistd.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <osg/Math>

#include <string>

#include <osgGLUT/Viewer>
#include <osgGLUT/GLUTEventAdapter>

#include <osg/Switch>
#include <osg/Billboard>
#include <osg/LOD>
#include <osg/Light>
#include <osg/LightSource>
#include <osg/Geode>
#include <osg/Group>
#include <osg/NodeVisitor>
#include <osg/LineSegment>
#include <osg/PolygonMode>
#include <osg/Texture>
#include <osg/Notify>

#include <osgDB/WriteFile>

#include <osgUtil/IntersectVisitor>
#include <osgUtil/DisplayListVisitor>
#include <osgUtil/SmoothingVisitor>
#include <osgUtil/TriStripVisitor>
#include <osgUtil/DisplayRequirementsVisitor>

#include <osgUtil/TrackballManipulator>
#include <osgUtil/FlightManipulator>
#include <osgUtil/DriveManipulator>

#include <osg/Version>
#include <osgUtil/Version>

#ifdef WIN32
#define USE_FLTK
#define USE_GLUT
#endif

#include <osgGLUT/glut>

#ifdef WIN32
#include <sys/timeb.h>
#else
#endif

#include <osg/Timer>
osg::Timer g_timer;
osg::Timer_t g_initTime;

//static GLenum polymodes [] = { GL_FILL, GL_LINE, GL_POINT };
static osg::PolygonMode::Mode polymodes [] = { osg::PolygonMode::FILL, osg::PolygonMode::LINE, osg::PolygonMode::POINT };

// forward declare functions to be used in stats.
GLuint makeRasterFont(void);
void displaytext(int x, int y, char *s);
int writePrims( const int ypos, osg::Statistics& stats);

using namespace osg;
using namespace osgUtil;
using namespace osgGLUT;



Viewer* Viewer::s_theViewer = 0;

Viewer::Viewer()
{
    s_theViewer = this;

    polymode = 0;
    texture = 1;
    backface = 1;
    lighting = 1;
    flat_shade = 0;

    _printStats = 0; // gwm change from bool was : false;

    #ifdef SGV_USE_RTFS
    fs = new RTfs( RTFS_MODE_RTC_SPIN );
    frame_rate = 16;
    fs->setUpdateRate( frame_rate );
    #endif

    _viewFrustumCullingActive = true;
    _smallFeatureCullingActive = true;

    _two_sided_lighting=0;

    _useDisplayLists = true;

    _saveFileName = "saved_model.osg";

    osg::notify(osg::INFO)<<"Scene Graph Viewer (sgv)"<< std::endl;

//    osg::notify(osg::INFO)<<"   '"<<osgGetLibraryName()<<"' Version "<<osgGetVersion()<< std::endl;
//    osg::notify(osg::INFO)<<"   '"<<osgUtilGetLibraryName()<<"' Version "<<osgUtilGetVersion()<< std::endl;

    _initialTick = _timer.tick();
    _frameTick = _initialTick;
    frRate=0; // added by gwm to display fram Rate smoothed

    _focusedViewport = 0;         // The viewport with mouse/keyboard focus
    
    
    _frameStamp = new osg::FrameStamp;
    
    _displaySettings = new osg::DisplaySettings;
}


Viewer::~Viewer()
{
}

/** read the command line string list, removing any matched control sequences.*/
void Viewer::readCommandLine(std::vector<std::string>& commandLine)
{
    _displaySettings->readCommandLine(commandLine);
}

/**
  * Configure and open the GLUT window for this Viewer
  * 
  */
bool Viewer::open()
{
    if ( getNumViewports() <= 0 ) {
        osg::notify(osg::FATAL)<<"osgGLUT::Viewer::open() called with no Viewports registered."<< std::endl;
        return false;
    }

    // Verify all viewports have an active camera manipulator 
    unsigned int index = 0;
    ViewportList::iterator itr;
    for(itr=_viewportList.begin();
        itr!=_viewportList.end();
        ++itr, ++index)
    {
        if (itr->_cameraManipList.empty())
        {
            osg::notify(osg::INFO)<<"osgGLUT::Viewer::open() called without any camara manipulators registered for a viewport,"<< std::endl;
            osg::notify(osg::INFO)<<"automatically registering trackball,flight and drive manipulators."<< std::endl;
            registerCameraManipulator(new osgUtil::TrackballManipulator, index);
            registerCameraManipulator(new osgUtil::FlightManipulator, index);
{'fraction_non_alphanumeric': 0.13389685164767856, 'fraction_numerical': 0.005880191106210952, 'mean_word_length': 4.35344262295082, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 79, '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': '4190298', 'n_tokens_mistral': 2921, 'n_tokens_neox': 2826, 'n_words': 659}