<commit_before>#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#include "ExportMesh.h"
#include "ExportMaterial.h"
#include "../VeritasEngine/Vertex.h"
#include "../VeritasEngine/StringHash.h"
#include "MeshExporterResult.h"


//#define ASSIMP_DLL

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

#include <boost/filesystem.hpp>
#include "../VeritasEngine/Skeleton.h"
#include "../VeritasEngineBase/StringHelper.h"

struct VeritasACP::ExportMesh::Impl
{
	Impl()
		: m_processedMaterials{}
	{

	}

	static MeshExporterSubset& AddSubset(std::shared_ptr<MeshExporterResult> meshInfo)
	{
		meshInfo->m_subsets.emplace_back();

		return meshInfo->m_subsets.back();
	}

	static void ProcessVertex(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		subset.m_vertexBaseIndex = result.m_verticies.size();
		subset.m_vertexCount = mesh->mNumVertices;

		for (unsigned int i = 0; i < mesh->mNumVertices; i++)
		{
			auto& vertex = mesh->mVertices[i];

			result.m_verticies.emplace_back();
			auto& position = result.m_verticies.back().Position;
			position.x = vertex.x;
			position.y = vertex.y;
			position.z = vertex.z;
		}
	}

	static void ProcessNormals(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (mesh->HasNormals())
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& vertex = result.m_verticies[subset.m_vertexBaseIndex + i].Normal;
				vertex.x = mesh->mNormals[i].x;
				vertex.y = mesh->mNormals[i].y;
				vertex.z = mesh->mNormals[i].z;
			}
		}

		if (mesh->HasTangentsAndBitangents())
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& tangent = result.m_verticies[subset.m_vertexBaseIndex + i].Tangent;
				tangent.x = mesh->mTangents[i].x;
				tangent.y = mesh->mTangents[i].y;
				tangent.z = mesh->mTangents[i].z;

				auto& binormal = result.m_verticies[subset.m_vertexBaseIndex + i].Binormal;
				binormal.x = mesh->mBitangents[i].x;
				binormal.y = mesh->mBitangents[i].y;
				binormal.z = mesh->mBitangents[i].z;
			}
		}
	}

	static void ProcessUVCoords(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (mesh->HasTextureCoords(0))
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& vertex = result.m_verticies[subset.m_vertexBaseIndex + i].TextureCoordinates;
				auto& coords = mesh->mTextureCoords[0][i];

				vertex.x = coords.x;
				vertex.y = coords.y;
			}
		}
	}

	void ProcessMaterial(const aiScene* scene, aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (scene->HasMaterials())
		{
			const auto item = m_processedMaterials.find(mesh->mMaterialIndex);

			if (item == m_processedMaterials.end())
			{
				ExportMaterial materialExporter;

				const auto materialResult = materialExporter.Export(m_basePath, scene, mesh);
				result.m_subsets.back().m_material = materialResult.ResourceName;

				const auto heightRatio = materialResult.NewTextureHeight / float(materialResult.OriginalTextureHeight ? materialResult.OriginalTextureHeight : 1);
				const auto widthRatio = materialResult.NewTextureWidth / float(materialResult.OriginalTextureWidth ? materialResult.OriginalTextureWidth : 1);

				for (unsigned int i = 0; i < mesh->mNumVertices; i++)
				{
					result.m_verticies[subset.m_vertexBaseIndex + i].TextureCoordinates.x *= widthRatio;
					result.m_verticies[subset.m_vertexBaseIndex + i].TextureCoordinates.y *= heightRatio;
				}

				m_processedMaterials.emplace(mesh->mMaterialIndex, result.m_subsets.back().m_material);
			}
			else
			{
				result.m_subsets.back().m_material = item->second;
			}
		}<commit_msg>removing change for image resizing<commit_after>#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#include "ExportMesh.h"
#include "ExportMaterial.h"
#include "../VeritasEngine/Vertex.h"
#include "../VeritasEngine/StringHash.h"
#include "MeshExporterResult.h"


//#define ASSIMP_DLL

#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>

#include <boost/filesystem.hpp>
#include "../VeritasEngine/Skeleton.h"
#include "../VeritasEngineBase/StringHelper.h"

struct VeritasACP::ExportMesh::Impl
{
	Impl()
		: m_processedMaterials{}
	{

	}

	static MeshExporterSubset& AddSubset(std::shared_ptr<MeshExporterResult> meshInfo)
	{
		meshInfo->m_subsets.emplace_back();

		return meshInfo->m_subsets.back();
	}

	static void ProcessVertex(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		subset.m_vertexBaseIndex = result.m_verticies.size();
		subset.m_vertexCount = mesh->mNumVertices;

		for (unsigned int i = 0; i < mesh->mNumVertices; i++)
		{
			auto& vertex = mesh->mVertices[i];

			result.m_verticies.emplace_back();
			auto& position = result.m_verticies.back().Position;
			position.x = vertex.x;
			position.y = vertex.y;
			position.z = vertex.z;
		}
	}

	static void ProcessNormals(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (mesh->HasNormals())
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& vertex = result.m_verticies[subset.m_vertexBaseIndex + i].Normal;
				vertex.x = mesh->mNormals[i].x;
				vertex.y = mesh->mNormals[i].y;
				vertex.z = mesh->mNormals[i].z;
			}
		}

		if (mesh->HasTangentsAndBitangents())
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& tangent = result.m_verticies[subset.m_vertexBaseIndex + i].Tangent;
				tangent.x = mesh->mTangents[i].x;
				tangent.y = mesh->mTangents[i].y;
				tangent.z = mesh->mTangents[i].z;

				auto& binormal = result.m_verticies[subset.m_vertexBaseIndex + i].Binormal;
				binormal.x = mesh->mBitangents[i].x;
				binormal.y = mesh->mBitangents[i].y;
				binormal.z = mesh->mBitangents[i].z;
			}
		}
	}

	static void ProcessUVCoords(aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (mesh->HasTextureCoords(0))
		{
			for (unsigned int i = 0; i < mesh->mNumVertices; i++)
			{
				auto& vertex = result.m_verticies[subset.m_vertexBaseIndex + i].TextureCoordinates;
				auto& coords = mesh->mTextureCoords[0][i];

				vertex.x = coords.x;
				vertex.y = coords.y;
			}
		}
	}

	void ProcessMaterial(const aiScene* scene, aiMesh* mesh, MeshExporterResult& result, MeshExporterSubset& subset)
	{
		if (scene->HasMaterials())
		{
			const auto item = m_processedMaterials.find(mesh->mMaterialIndex);

			if (item == m_processedMaterials.end())
			{
				ExportMaterial materialExporter;

				const auto materialResult = materialExporter.Export(m_basePath, scene, mesh);
				result.m_subsets.back().m_material = materialResult.ResourceName;

				m_processedMaterials.emplace(mesh->mMaterialIndex, result.m_subsets.back().m_material);
			}
			else
			{
				result.m_subsets.back().m_material = item->second;
			}
		}
{'fraction_non_alphanumeric': 0.13975065236300377, 'fraction_numerical': 0.0021745433458973617, 'mean_word_length': 4.156203288490284, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 72, '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': '324677', 'n_tokens_mistral': 2798, 'n_tokens_neox': 2464, 'n_words': 426}