<commit_before>//============================================================================
// Name        : IRenderer.cpp
// Author      : <NAME>
// Version     :
// Copyright   : ;)
// Description : Renderer Interface
//============================================================================

#include <Pyros3D/Rendering/Renderer/IRenderer.h>
#include <Pyros3D/Other/PyrosGL.h>

namespace p3d {

	// ViewPort Dimension
	uint32 IRenderer::_viewPortStartX = 0;
	uint32 IRenderer::_viewPortStartY = 0;
	uint32 IRenderer::_viewPortEndX = 0;
	uint32 IRenderer::_viewPortEndY = 0;

	IRenderer::IRenderer() {}

	IRenderer::IRenderer(const uint32 Width, const uint32 Height)
	{
		// Background Unset by Default
		BackgroundColorSet = false;

		// Set Global Light Default Color
		GlobalLight = Vec4(0.2f, 0.2f, 0.2f, 0.2f);

		// Save Dimensions
		this->Width = Width;
		this->Height = Height;

		// Depth Bias
		IsUsingDepthBias = false;

		// Custom ViewPort
		customViewPort = false;

		// Blending Flag
		blending = false;

		// Defaults
		ClearBufferBit(Buffer_Bit::Color | Buffer_Bit::Depth);
		depthWritting = depthTesting = false;
		clearDepthBuffer = true;
		sorting = true;
		scissorTest = false;
		scissorTestX = 0;
		scissorTestY = 0;
		scissorTestWidth = Width;
		scissorTestHeight = Height;
		lod = false;
		ClipPlane = false;
	}

	void IRenderer::Resize(const uint32 Width, const uint32 Height)
	{
		// Save Dimensions
		this->Width = Width;
		this->Height = Height;

		if (!customViewPort)
		{
			viewPortEndX = Width;
			viewPortEndY = Height;
		}
	}

	void IRenderer::SetViewPort(const uint32 initX, const uint32 initY, const uint32 endX, const uint32 endY)
	{
		viewPortStartX = initX;
		viewPortStartY = initY;
		viewPortEndX = endX;
		viewPortEndY = endY;
		customViewPort = true;
	}
	void IRenderer::_SetViewPort(const uint32 initX, const uint32 initY, const uint32 endX, const uint32 endY)
	{
		if (initX != _viewPortStartX || initY != _viewPortStartY || endX != _viewPortEndX || endY != _viewPortEndY)
		{
			_viewPortStartX = initX;
			_viewPortStartY = initY;
			_viewPortEndX = endX;
			_viewPortEndY = endY;
			GLCHECKER(glViewport(initX, initY, endX, endY));
		}
	}

	IRenderer::~IRenderer()
	{

	}

	// Internal Function
	void IRenderer::RenderScene(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene) {

	}
	void IRenderer::RenderSceneByTag(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene, const uint32 Tag) {

	}
	void IRenderer::RenderSceneByTag(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene, const std::string &Tag) {

	}

	void IRenderer::InitRender()
	{
		LastProgramUsed = -1;
		LastMaterialUsed = -1;
		LastMeshRendered = -1;
		InternalDrawType = -1;
		LastMaterialPTR = NULL;
		LastMeshRenderedPTR = NULL;
		cullFace = -1;
	}

	void IRenderer::EndRender()
	{
		if (LastMeshRenderedPTR != NULL && LastMaterialPTR != NULL)
		{
			// Unbind Index Buffer
			if (LastMeshRenderedPTR->Geometry->GetGeometryType() == GeometryType::BUFFER)
				GLCHECKER(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
			// Unbind Vertex Attributes
			UnbindMesh(LastMeshRenderedPTR, LastMaterialPTR);
			// Unbind Shadow Maps
			UnbindShadowMaps(LastMaterialPTR);
			// Material After Render
			LastMaterialPTR->AfterRender();
			// Unbind Shader Program
			GLCHECKER(glUseProgram(0));
			// Unset Pointers
			LastMaterialPTR = NULL;
			LastMeshRenderedPTR = NULL;
			LastProgramUsed = -1;
			LastMaterialUsed = -1;
			LastMeshRendered = -1;
			depthWritting = false;
			depthTesting = false;

			DepthTest();
			DepthWrite();

			DisableBlending();
		}
	}

	void IRenderer::RenderObject(RenderingMesh* rmesh, GameObject* owner, IMaterial* Material)<commit_msg>Fixed a small rendering issue<commit_after>//============================================================================
// Name        : IRenderer.cpp
// Author      : <NAME>
// Version     :
// Copyright   : ;)
// Description : Renderer Interface
//============================================================================

#include <Pyros3D/Rendering/Renderer/IRenderer.h>
#include <Pyros3D/Other/PyrosGL.h>

namespace p3d {

	// ViewPort Dimension
	uint32 IRenderer::_viewPortStartX = 0;
	uint32 IRenderer::_viewPortStartY = 0;
	uint32 IRenderer::_viewPortEndX = 0;
	uint32 IRenderer::_viewPortEndY = 0;

	IRenderer::IRenderer() {}

	IRenderer::IRenderer(const uint32 Width, const uint32 Height)
	{
		// Background Unset by Default
		BackgroundColorSet = false;

		// Set Global Light Default Color
		GlobalLight = Vec4(0.2f, 0.2f, 0.2f, 0.2f);

		// Save Dimensions
		this->Width = Width;
		this->Height = Height;

		// Depth Bias
		IsUsingDepthBias = false;

		// Custom ViewPort
		customViewPort = false;

		// Blending Flag
		blending = false;

		// Defaults
		ClearBufferBit(Buffer_Bit::Color | Buffer_Bit::Depth);
		depthWritting = depthTesting = false;
		clearDepthBuffer = true;
		sorting = true;
		scissorTest = false;
		scissorTestX = 0;
		scissorTestY = 0;
		scissorTestWidth = Width;
		scissorTestHeight = Height;
		lod = false;
		ClipPlane = false;
	}

	void IRenderer::Resize(const uint32 Width, const uint32 Height)
	{
		// Save Dimensions
		this->Width = Width;
		this->Height = Height;

		if (!customViewPort)
		{
			viewPortEndX = Width;
			viewPortEndY = Height;
		}
	}

	void IRenderer::SetViewPort(const uint32 initX, const uint32 initY, const uint32 endX, const uint32 endY)
	{
		viewPortStartX = initX;
		viewPortStartY = initY;
		viewPortEndX = endX;
		viewPortEndY = endY;
		customViewPort = true;
	}
	void IRenderer::_SetViewPort(const uint32 initX, const uint32 initY, const uint32 endX, const uint32 endY)
	{
		if (initX != _viewPortStartX || initY != _viewPortStartY || endX != _viewPortEndX || endY != _viewPortEndY)
		{
			_viewPortStartX = initX;
			_viewPortStartY = initY;
			_viewPortEndX = endX;
			_viewPortEndY = endY;
			GLCHECKER(glViewport(initX, initY, endX, endY));
		}
	}

	IRenderer::~IRenderer()
	{

	}

	// Internal Function
	void IRenderer::RenderScene(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene) {

	}
	void IRenderer::RenderSceneByTag(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene, const uint32 Tag) {

	}
	void IRenderer::RenderSceneByTag(const p3d::Projection& projection, GameObject* Camera, SceneGraph* Scene, const std::string &Tag) {

	}

	void IRenderer::InitRender()
	{
		LastProgramUsed = -1;
		LastMaterialUsed = -1;
		LastMeshRendered = -1;
		InternalDrawType = -1;
		LastMaterialPTR = NULL;
		LastMeshRenderedPTR = NULL;
		cullFace = -1;
	}

	void IRenderer::EndRender()
	{
		if (LastMeshRenderedPTR != NULL && LastMaterialPTR != NULL)
		{
			// Unbind Index Buffer
			if (LastMeshRenderedPTR->Geometry->GetGeometryType() == GeometryType::BUFFER)
				GLCHECKER(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
			// Unbind Vertex Attributes
			UnbindMesh(LastMeshRenderedPTR, LastMaterialPTR);
			// Unbind Shadow Maps
			UnbindShadowMaps(LastMaterialPTR);
			// Material After Render
			LastMaterialPTR->AfterRender();
		}

		// Unbind Shader Program
		GLCHECKER(glUseProgram(0));
		// Unset Pointers
		LastMaterialPTR = NULL;
		LastMeshRenderedPTR = NULL;
		LastProgramUsed = -1;
		LastMaterialUsed = -1;
		LastMeshRendered = -1;
		depthWritting = false;
		depthTesting = false;

		DepthTest();
		DepthWrite();

		DisableBlending();
	}

	void IRenderer::RenderObject(RenderingMesh* rmesh, GameObject* owner, IMaterial* Material)
{'fraction_non_alphanumeric': 0.14883969058415578, 'fraction_numerical': 0.017337956788476928, 'mean_word_length': 4.153951890034365, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 23, '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': '924141', 'n_tokens_mistral': 2837, 'n_tokens_neox': 2481, 'n_words': 559}