<commit_before>#ifndef RADIUMENGINE_ASSIMP_WRAPPER_HPP
#define RADIUMENGINE_ASSIMP_WRAPPER_HPP

#include <assimp/vector3.h>
#include <assimp/quaternion.h>
#include <assimp/matrix4x4.h>
#include <assimp/color4.h>
#include <assimp/types.h>

#include <Core/Math/LinearAlgebra.hpp>

namespace Ra {
    namespace IO {

        inline Core::Vector3 assimpToCore( const aiVector3D& v ) {
            return Core::Vector3( v.x, v.y, v.z );
        }

        inline aiVector3D coreToAssimp( const Core::Vector3& v ) {
            return aiVector3D( v.x(), v.y(), v.z() );
        }

        inline Core::Quaternion assimpToCore( const aiQuaternion& q ) {
            return Core::Quaternion( q.w, q.x, q.y, q.z );
        }

        inline Core::Transform assimpToCore( const aiMatrix4x4& M ) {
            Core::Matrix4 m( Core::Matrix4::Identity() );
            for( uint i = 0; i < 4; ++i )
            {
                for( uint j = 0; j < 4; ++j )
                {
                    m( i, j ) = M[i][j];
                }
            }
            return Core::Transform( m );
        }

        inline Core::Transform assimpToCore( const aiVector3D&    T,
                                             const aiQuaternion& R,
                                             const aiVector3D&    S ) {
            Core::Vector3    t = assimpToCore( T );
            Core::Quaternion r = assimpToCore( R );
            Core::Vector3    s = assimpToCore( S );
            Core::Transform M;
            M.fromPositionOrientationScale( t, r, s );
            return M;
        }

        inline Core::Color assimpToCore( const aiColor4D& c ) {
            return Core::Color( c.r, c.g, c.b, c.a );
        }

        inline std::string assimpToCore( const aiString& string ) {
            std::string result ( string.C_Str() );
            return result.empty() ? "default" : result;
        }

        inline Core::VectorNi assimpToCore( uint* index, const uint size )
        {
            Core::VectorNi v( size );
            for( uint i = 0; i < size; ++i ) {
                v[i] = index[i];
            }

            return v;
        }

    } // namespace IO
} // namespace Ra

#endif // RADIUMENGINE_ASSIMP_WRAPPER_HPP
<commit_msg>Handle filenames with \ characters<commit_after>#ifndef RADIUMENGINE_ASSIMP_WRAPPER_HPP
#define RADIUMENGINE_ASSIMP_WRAPPER_HPP

#include <assimp/vector3.h>
#include <assimp/quaternion.h>
#include <assimp/matrix4x4.h>
#include <assimp/color4.h>
#include <assimp/types.h>

#include <Core/Math/LinearAlgebra.hpp>

namespace Ra {
    namespace IO {

        inline Core::Vector3 assimpToCore( const aiVector3D& v ) {
            return Core::Vector3( v.x, v.y, v.z );
        }

        inline aiVector3D coreToAssimp( const Core::Vector3& v ) {
            return aiVector3D( v.x(), v.y(), v.z() );
        }

        inline Core::Quaternion assimpToCore( const aiQuaternion& q ) {
            return Core::Quaternion( q.w, q.x, q.y, q.z );
        }

        inline Core::Transform assimpToCore( const aiMatrix4x4& M ) {
            Core::Matrix4 m( Core::Matrix4::Identity() );
            for( uint i = 0; i < 4; ++i )
            {
                for( uint j = 0; j < 4; ++j )
                {
                    m( i, j ) = M[i][j];
                }
            }
            return Core::Transform( m );
        }

        inline Core::Transform assimpToCore( const aiVector3D&    T,
                                             const aiQuaternion& R,
                                             const aiVector3D&    S ) {
            Core::Vector3    t = assimpToCore( T );
            Core::Quaternion r = assimpToCore( R );
            Core::Vector3    s = assimpToCore( S );
            Core::Transform M;
            M.fromPositionOrientationScale( t, r, s );
            return M;
        }

        inline Core::Color assimpToCore( const aiColor4D& c ) {
            return Core::Color( c.r, c.g, c.b, c.a );
        }

        inline std::string assimpToCore( const aiString& string ) {
            std::string result ( string.C_Str() );
            std::transform(result.begin(), result.end(), result.begin(),
                           [](char in){if(in == '\\') return '/'; return in;});
            return result.empty() ? "default" : result;
        }

        inline Core::VectorNi assimpToCore( uint* index, const uint size )
        {
            Core::VectorNi v( size );
            for( uint i = 0; i < size; ++i ) {
                v[i] = index[i];
            }

            return v;
        }

    } // namespace IO
} // namespace Ra

#endif // RADIUMENGINE_ASSIMP_WRAPPER_HPP

{'fraction_non_alphanumeric': 0.12295434969853575, 'fraction_numerical': 0.0103359173126615, 'mean_word_length': 1.5834260289210234, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5379816', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1430, 'n_words': 349}