<commit_before>#ifndef __FLT_GEOSETBUILDER_H
#define __FLT_GEOSETBUILDER_H

#include <osg/ref_ptr>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/GeoSet>
#include <osg/Geode>
#include <osg/Material>
#include <osg/StateSet>

#include <map>
#include <vector>


namespace flt {

class Record;
class TmpGeoSet;



////////////////////////////////////////////////////////////////////
//
//                       DynGeoSet
//
////////////////////////////////////////////////////////////////////
#if 0
#  define COMPARE_DynGeoSet_Parameter(parameter) \
        if (parameter<rhs.parameter) return -1; \
        if (rhs.parameter<parameter) return 1;
#else
#  define COMPARE_DynGeoSet_Parameter(parameter) \
        if (parameter != rhs.parameter) return -1;
#endif

/** DynGeoSet - Dynamic GeoSet.
  * Problem: osg::GeoSet use C arrays (static size) for coordinates,
  * normals, colors and texture coordinates.
  */ 
class DynGeoSet : public osg::GeoSet
{
    public:

        virtual osg::Object* clone() const { return new DynGeoSet(); }
        virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const DynGeoSet*>(obj)!=NULL; }
        virtual const char* className() const { return "DynGeoSet"; }

        int compare(const DynGeoSet& rhs) const
        {
            COMPARE_DynGeoSet_Parameter(_primtype)
            COMPARE_DynGeoSet_Parameter(_color_binding)
            COMPARE_DynGeoSet_Parameter(_normal_binding)
            COMPARE_DynGeoSet_Parameter(_texture_binding)

            if ((_color_binding == osg::GeoSet::BIND_OVERALL)
            &&  (_colorList.size() >= 1) &&  (rhs._colorList.size() >= 1)
            &&  (_colorList[0] != rhs._colorList[0]))
                return -1;

            return getStateSet()->compare(*rhs.getStateSet(), true);
        }
        
        bool operator <  (const DynGeoSet& rhs) const { return compare(rhs)<0; }
        bool operator == (const DynGeoSet& rhs) const { return compare(rhs)==0; }
        bool operator != (const DynGeoSet& rhs) const { return compare(rhs)!=0; }

        inline void addPrimLen(const int len)           { _primLenList.push_back(len); }
        inline void addCoord(const osg::Vec3& coord)    { _coordList.push_back(coord); }
        inline void addNormal(const osg::Vec3& normal)  { _normalList.push_back(normal); }
        inline void addColor(const osg::Vec4& color)    { _colorList.push_back(color); }
        inline void addTCoord(const osg::Vec2& tcoord)  { _tcoordList.push_back(tcoord); }

        void append(DynGeoSet* source);
        void setBinding();
        bool setLists();
<commit_msg>Updates to the flt loader, from <NAME>.<commit_after>#ifndef __FLT_GEOSETBUILDER_H
#define __FLT_GEOSETBUILDER_H

#include <osg/ref_ptr>
#include <osg/Vec2>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/GeoSet>
#include <osg/Geode>
#include <osg/Material>
#include <osg/StateSet>

#include <map>
#include <vector>


namespace flt {

class Record;
class TmpGeoSet;



////////////////////////////////////////////////////////////////////
//
//                       DynGeoSet
//
////////////////////////////////////////////////////////////////////
#if 0
#  define COMPARE_DynGeoSet_Parameter(parameter) \
        if (parameter<rhs.parameter) return -1; \
        if (rhs.parameter<parameter) return 1;
#else
#  define COMPARE_DynGeoSet_Parameter(parameter) \
        if (parameter != rhs.parameter) return -1;
#endif

/** DynGeoSet - Dynamic GeoSet.
  * Problem: osg::GeoSet use C arrays (static size) for coordinates,
  * normals, colors and texture coordinates.
  */ 
class DynGeoSet : public osg::GeoSet
{
    public:

        virtual osg::Object* clone() const { return new DynGeoSet(); }
        virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const DynGeoSet*>(obj)!=NULL; }
        virtual const char* className() const { return "GeoSet"; }

        int compare(const DynGeoSet& rhs) const
        {
            COMPARE_DynGeoSet_Parameter(_primtype)
            COMPARE_DynGeoSet_Parameter(_color_binding)
            COMPARE_DynGeoSet_Parameter(_normal_binding)
            COMPARE_DynGeoSet_Parameter(_texture_binding)

            if ((_color_binding == osg::GeoSet::BIND_OVERALL)
            &&  (_colorList.size() >= 1) &&  (rhs._colorList.size() >= 1)
            &&  (_colorList[0] != rhs._colorList[0]))
                return -1;

            return getStateSet()->compare(*rhs.getStateSet(), true);
        }
        
        bool operator <  (const DynGeoSet& rhs) const { return compare(rhs)<0; }
        bool operator == (const DynGeoSet& rhs) const { return compare(rhs)==0; }
        bool operator != (const DynGeoSet& rhs) const { return compare(rhs)!=0; }

        inline void addPrimLen(const int len)           { _primLenList.push_back(len); }
        inline void addCoord(const osg::Vec3& coord)    { _coordList.push_back(coord); }
        inline void addNormal(const osg::Vec3& normal)  { _normalList.push_back(normal); }
        inline void addColor(const osg::Vec4& color)    { _colorList.push_back(color); }
        inline void addTCoord(const osg::Vec2& tcoord)  { _tcoordList.push_back(tcoord); }

        void append(DynGeoSet* source);
        void setBinding();
        bool setLists();

{'fraction_non_alphanumeric': 0.1653766282801586, 'fraction_numerical': 0.007173872003020577, 'mean_word_length': 2.4582245430809397, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 32, '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': '910381', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1673, 'n_words': 368}