<commit_before>#include "RenderWidget.h"

D3DRenderWidget::~D3DRenderWidget()
{
	Resources::Status status;
	status = this->m_Communicator->Release();
	if (status == Resources::ST_OK)
	{
		delete this->m_Communicator;
	}
}

void D3DRenderWidget::paintEvent(QPaintEvent * evt)
{
	this->m_frameCount++;
	if (getTime() > 1.0f)
	{
		this->m_fps = this->m_frameCount;
		this->m_frameCount = 0;
		startTimer();
	}
	this->m_frameTime = getFrameTime();

	if (!this->m_Communicator->m_IsPreview)
	{
		this->m_Communicator->m_EditorInputHandler->detectInput(this->m_frameTime);
	}

	//SEND COMPONENT DATA TO HANDLER
	//this->m_Communicator->m_GraphicsHandler->Sendshit();
	//THEN RENDER
	Resources::Status st;
	std::vector<Container>* InstancePtr = nullptr;
	std::vector<Resources::Model*>* modelPtr = this->m_fileImporter->get_M_models();
	this->m_Communicator->m_GraphicsHandler->clearEditor();

	if (!this->m_Communicator->m_Map.empty())
	{
		for (size_t i = 0; i < modelPtr->size(); i++)
		{
			std::unordered_map<unsigned int, std::vector<Container>>::iterator got = this->m_Communicator->m_Map.find(modelPtr->at(i)->GetId());
			
			if (got == this->m_Communicator->m_Map.end()) { // if  does not exists in memory

			}
			else {
				InstancePtr = &got->second;
				for (size_t j = 0; j < InstancePtr->size(); j++)
				{
					this->m_Communicator->m_GraphicsHandler->RenderFromEditor(
						modelPtr->at(i),
						&InstancePtr->at(j).component
					);
				}

			}

		}
		this->m_Communicator->m_GraphicsHandler->renderFinalEditor();
	}
	else
	{
		this->m_Communicator->m_GraphicsHandler->Render();
	}
	std::cout << this->m_frameTime << std::endl;
	this->update();
}

void D3DRenderWidget::Initialize(QWidget* parent, bool isPreview, FileImporter* fileImporter)
{<commit_msg>UPDATE small fixes to fps counter and general render loop<commit_after>#include "RenderWidget.h"

D3DRenderWidget::~D3DRenderWidget()
{
	Resources::Status status;
	status = this->m_Communicator->Release();
	if (status == Resources::ST_OK)
	{
		delete this->m_Communicator;
	}
}

void D3DRenderWidget::paintEvent(QPaintEvent * evt)
{
	this->m_frameCount++;
	if (getTime() > 1.0f)
	{
		this->m_fps = this->m_frameCount;
		this->m_frameCount = 0;
		startTimer();
	}
	this->m_frameTime = getFrameTime();

	if (!this->m_Communicator->m_IsPreview)
	{
		this->m_Communicator->m_EditorInputHandler->detectInput(this->m_frameTime);
	}

	//SEND COMPONENT DATA TO HANDLER
	//this->m_Communicator->m_GraphicsHandler->Sendshit();
	//THEN RENDER

	if (!this->m_Communicator->m_Map.empty())
	{
	Resources::Status st;
	std::vector<Container>* InstancePtr = nullptr;
	std::vector<Resources::Model*>* modelPtr = this->m_fileImporter->get_M_models();
	this->m_Communicator->m_GraphicsHandler->clearEditor();

	for (size_t i = 0; i < modelPtr->size(); i++)
		{
			std::unordered_map<unsigned int, std::vector<Container>>::iterator got = this->m_Communicator->m_Map.find(modelPtr->at(i)->GetId());
			
			if (got == this->m_Communicator->m_Map.end()) { // if  does not exists in memory

			}
			else {
				InstancePtr = &got->second;
				for (size_t j = 0; j < InstancePtr->size(); j++)
				{
					this->m_Communicator->m_GraphicsHandler->RenderFromEditor(
						modelPtr->at(i),
						&InstancePtr->at(j).component
					);
				}

			}

		}
		this->m_Communicator->m_GraphicsHandler->renderFinalEditor();
	}
	else
	{
		this->m_Communicator->m_GraphicsHandler->Render();
	}
	std::cout << "FPS: " << this->m_fps << std::endl;
	this->update();
}

void D3DRenderWidget::Initialize(QWidget* parent, bool isPreview, FileImporter* fileImporter)
{
{'fraction_non_alphanumeric': 0.16866462224700307, 'fraction_numerical': 0.005018120992472818, 'mean_word_length': 4.615023474178404, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 105, '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': '3091116', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1298, 'n_words': 202}