<commit_before>﻿using Assimp;
using NLog;
using OpenKh.Command.MapGen.Models;
using OpenKh.Command.MapGen.Models;
using OpenKh.Command.MapGen.Utils;
using OpenKh.Common;
using OpenKh.Engine.Parsers;
using OpenKh.Kh2;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using Xe.Graphics;
using static OpenKh.Kh2.Mdlx;

namespace OpenKh.Command.MapGen.Utils
{
    public class MapBuilder
    {
        private const int MaxVertCount = 71;

        private Mdlx.M4 mapModel;
        private BigMeshContainer bigMeshContainer;
        private ModelTexture modelTex;
        private CollisionBuilder collisionBuilder;
        private Logger logger = LogManager.GetCurrentClassLogger();
        private readonly MapGenConfig config;

        public MapBuilder(string modelFile, MapGenConfig config, Func<MaterialDef, Imgd> imageLoader)
        {
            this.config = config;

            ConvertModelIntoMapModel(modelFile, config);

            collisionBuilder = new CollisionBuilder(bigMeshContainer.MeshList);

            {
                var matDefList = bigMeshContainer.AllocatedMaterialDefs;
                modelTex = new ModelTexture(
                    matDefList
                        .Select(matDef => imageLoader(matDef))
                        .ToArray()
                );
            }
        }

        private void ConvertModelIntoMapModel(string modelFile, MapGenConfig config)
        {
            logger.Debug($"Loading 3D model file \"{modelFile}\" using Assimp.");

            var assimp = new AssimpContext();
            var scene = assimp.ImportFile(modelFile, PostProcessSteps.PreTransformVertices);

            bigMeshContainer = new BigMeshContainer();

            var scale = config.scale;

            logger.Debug($"Starting triangle strip conversion for {scene.Meshes.Count} meshes.");

            foreach (var inputMesh in scene.Meshes)
            {<commit_msg>Print progress of longer collision builder.<commit_after>﻿using Assimp;
using NLog;
using OpenKh.Command.MapGen.Models;
using OpenKh.Command.MapGen.Models;
using OpenKh.Command.MapGen.Utils;
using OpenKh.Common;
using OpenKh.Engine.Parsers;
using OpenKh.Kh2;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using Xe.Graphics;
using static OpenKh.Kh2.Mdlx;

namespace OpenKh.Command.MapGen.Utils
{
    public class MapBuilder
    {
        private const int MaxVertCount = 71;

        private Mdlx.M4 mapModel;
        private BigMeshContainer bigMeshContainer;
        private ModelTexture modelTex;
        private CollisionBuilder collisionBuilder;
        private Logger logger = LogManager.GetCurrentClassLogger();
        private readonly MapGenConfig config;

        public MapBuilder(string modelFile, MapGenConfig config, Func<MaterialDef, Imgd> imageLoader)
        {
            this.config = config;

            ConvertModelIntoMapModel(modelFile, config);

            logger.Debug($"Starting collision plane builder.");

            collisionBuilder = new CollisionBuilder(bigMeshContainer.MeshList);

            logger.Debug($"Output: {collisionBuilder.coct.CollisionList.Count:#,##0} collision planes");

            {
                var matDefList = bigMeshContainer.AllocatedMaterialDefs;
                modelTex = new ModelTexture(
                    matDefList
                        .Select(matDef => imageLoader(matDef))
                        .ToArray()
                );
            }
        }

        private void ConvertModelIntoMapModel(string modelFile, MapGenConfig config)
        {
            logger.Debug($"Loading 3D model file \"{modelFile}\" using Assimp.");

            var assimp = new AssimpContext();
            var scene = assimp.ImportFile(modelFile, PostProcessSteps.PreTransformVertices);

            bigMeshContainer = new BigMeshContainer();

            var scale = config.scale;

            logger.Debug($"Starting triangle strip conversion for {scene.Meshes.Count} meshes.");

            foreach (var inputMesh in scene.Meshes)
            {
{'fraction_non_alphanumeric': 0.07943364530837534, 'fraction_numerical': 0.0031197504199664025, 'mean_word_length': 2.4646716541978386, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '660616', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1057, 'n_words': 267}