<commit_before>// BulletPhysicsSystemData.cpp

#include <Resource/Resources/StaticMesh.h>
#include "../private/BulletPhysicsSystemData.h"
#include "../private/PhysicsEntity.h"
#include "../private/Util.h"
#include "../private/Colliders.h"

namespace sge
{
    namespace bullet_physics
	{
		static std::unique_ptr<StaticMeshCollider> create_static_mesh_collider_mesh(std::string path, const StaticMesh& mesh)
		{
			const auto num_verts = mesh.num_verts();
			const auto* const vert_positions = mesh.vertex_positions();
			const auto* const triangle_elements = mesh.triangle_elements();

			// Build the mesh
			auto bt_mesh = std::make_unique<StaticMeshCollider>();
			bt_mesh->path = std::move(path);
			bt_mesh->mesh.preallocateVertices((int)mesh.num_verts());
			for (std::size_t i = 0; i < num_verts; i += 3)
			{
				bt_mesh->mesh.addTriangle(
					to_bullet(vert_positions[triangle_elements[i + 0]]),
					to_bullet(vert_positions[triangle_elements[i + 1]]),
					to_bullet(vert_positions[triangle_elements[i + 2]]));
			}
			bt_mesh->init_shape();

			return bt_mesh;
		}

        PhysicsEntity& BulletPhysicsSystem::Data::get_or_create_physics_entity(NodeId node_id, const Node& node)
        {
            // Search for the entity
            auto iter = physics_entities.find(node_id);
            if (iter != physics_entities.end())
            {
                // Return the existing physics entity
                return *iter->second;
            }

            // Create a new physics entity
            auto phys = std::make_unique<PhysicsEntity>(node_id, *this);<commit_msg>Fixed bug with building mesh colliders<commit_after>// BulletPhysicsSystemData.cpp

#include <Resource/Resources/StaticMesh.h>
#include "../private/BulletPhysicsSystemData.h"
#include "../private/PhysicsEntity.h"
#include "../private/Util.h"
#include "../private/Colliders.h"

namespace sge
{
    namespace bullet_physics
	{
		static std::unique_ptr<StaticMeshCollider> create_static_mesh_collider_mesh(std::string path, const StaticMesh& mesh)
		{
			const auto num_verts = mesh.num_verts();
			const auto num_triangles = mesh.num_triangles();
			const auto* const vert_positions = mesh.vertex_positions();
			const auto* const triangle_elements = mesh.triangle_elements();

			// Build the mesh
			auto bt_mesh = std::make_unique<StaticMeshCollider>();
			bt_mesh->path = std::move(path);
			bt_mesh->mesh.preallocateVertices((int)num_verts);
			for (std::size_t i = 0; i < num_triangles; ++i)
			{
				bt_mesh->mesh.addTriangle(
					to_bullet(vert_positions[triangle_elements[i * 3 + 0]]),
					to_bullet(vert_positions[triangle_elements[i * 3 + 1]]),
					to_bullet(vert_positions[triangle_elements[i * 3 + 2]]));
			}
			bt_mesh->init_shape();

			return bt_mesh;
		}

        PhysicsEntity& BulletPhysicsSystem::Data::get_or_create_physics_entity(NodeId node_id, const Node& node)
        {
            // Search for the entity
            auto iter = physics_entities.find(node_id);
            if (iter != physics_entities.end())
            {
                // Return the existing physics entity
                return *iter->second;
            }

            // Create a new physics entity
            auto phys = std::make_unique<PhysicsEntity>(node_id, *this);
{'fraction_non_alphanumeric': 0.12090602999693909, 'fraction_numerical': 0.0036730945821854912, 'mean_word_length': 3.277486910994764, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '4329355', 'n_tokens_mistral': 1125, 'n_tokens_neox': 992, 'n_words': 202}