<commit_before>//**************************************************************
//*				OpenGLide - Glide->OpenGL Wrapper
//*				   Depth (Z/W-Buffer) Functions
//*					   Made by Glorfindel
//**************************************************************

#include "GlOgl.h"
#include "GLRender.h"

//*************************************************
//* Changes Depth Buffer Mode
//*************************************************
DLLEXPORT void __stdcall
grDepthBufferMode( GrDepthBufferMode_t mode )
{
#ifdef DONE
	GlideMsg( "grDepthBufferMode( %d )\n", mode );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBufferMode = mode;

	switch ( mode )
	{
	case GR_DEPTHBUFFER_DISABLE:
		glDisable( GL_DEPTH_TEST );
		return;
	case GR_DEPTHBUFFER_ZBUFFER:
	case GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS:
		OpenGL.ZNear = ZBUFFERNEAR;
		OpenGL.ZFar = ZBUFFERFAR;
		break;
	case GR_DEPTHBUFFER_WBUFFER:
	case GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS:
		OpenGL.ZNear = WBUFFERNEAR;
		OpenGL.ZFar = WBUFFERFAR;
		break;
	}
	glEnable( GL_DEPTH_TEST );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();

	if (Glide.State.OriginInformation == GR_ORIGIN_LOWER_LEFT)
	{
		glOrtho( 0, Glide.WindowWidth, 0, Glide.WindowHeight, OpenGL.ZNear, OpenGL.ZFar );
	}
	else
	{
		glOrtho( 0, Glide.WindowWidth, Glide.WindowHeight, 0, OpenGL.ZNear, OpenGL.ZFar );
	}
	glViewport( 0,0, OpenGL.WindowWidth, OpenGL.WindowHeight );	

	glMatrixMode( GL_MODELVIEW );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBufferMode" );
#endif
}

//*************************************************
//* Enables or Disables Depth Buffer Writting
//*************************************************
DLLEXPORT void __stdcall
grDepthMask( FxBool enable )
{
#ifdef DONE
	GlideMsg( "grDepthMask( %d )\n", enable );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBufferWritting = enable;

	if (Glide.State.DepthBufferWritting == FXFALSE)
		OpenGL.DepthBufferWritting = GL_FALSE;
	else
		OpenGL.DepthBufferWritting = GL_TRUE;

	glDepthMask( OpenGL.DepthBufferWritting );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthMask" );
#endif
}

//*************************************************
//* Sets the Depth Function to use
//*************************************************
DLLEXPORT void __stdcall
grDepthBufferFunction( GrCmpFnc_t func )
{
#ifdef DONE
	GlideMsg( "grDepthBufferFunction( %d )\n", func );
#endif

	RenderDrawTriangles();

	Glide.State.DepthFunction = func;
	switch ( func )
	{
	case GR_CMP_NEVER:		OpenGL.DepthFunction = GL_NEVER;		break;
	case GR_CMP_LESS:		OpenGL.DepthFunction = GL_LESS;			break;
	case GR_CMP_EQUAL: 		OpenGL.DepthFunction = GL_EQUAL;		break;
	case GR_CMP_LEQUAL: 	OpenGL.DepthFunction = GL_LEQUAL;		break;
	case GR_CMP_GREATER: 	OpenGL.DepthFunction = GL_GREATER;		break;
	case GR_CMP_NOTEQUAL: 	OpenGL.DepthFunction = GL_NOTEQUAL;		break;
	case GR_CMP_GEQUAL: 	OpenGL.DepthFunction = GL_GEQUAL;		break;
	case GR_CMP_ALWAYS:		OpenGL.DepthFunction = GL_ALWAYS;		break;
	}

	glDepthFunc( OpenGL.DepthFunction );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBufferFunction" );
#endif
}

//*************************************************
//* Set the depth bias level
//*************************************************
DLLEXPORT void __stdcall
grDepthBiasLevel( FxI16 level )
{
#ifdef PARTDONE
	GlideMsg( "grDepthBiasLevel( %d )\n", level );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBiasLevel = level;
	OpenGL.DepthBiasLevel = level * D1OVER65536;

	glPolygonOffset( 1.0f, OpenGL.DepthBiasLevel );

	if ( level != 0 )
	{
		glEnable( GL_POLYGON_OFFSET_FILL );
	}
	else
	{
		glDisable( GL_POLYGON_OFFSET_FILL );
	}

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBiasLevel" );
#endif
}
<commit_msg>Increase the effect of depth bias to make Lara's shadow constantly visible.<commit_after>//**************************************************************
//*				OpenGLide - Glide->OpenGL Wrapper
//*				   Depth (Z/W-Buffer) Functions
//*					   Made by Glorfindel
//**************************************************************

#include "GlOgl.h"
#include "GLRender.h"

//*************************************************
//* Changes Depth Buffer Mode
//*************************************************
DLLEXPORT void __stdcall
grDepthBufferMode( GrDepthBufferMode_t mode )
{
#ifdef DONE
	GlideMsg( "grDepthBufferMode( %d )\n", mode );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBufferMode = mode;

	switch ( mode )
	{
	case GR_DEPTHBUFFER_DISABLE:
		glDisable( GL_DEPTH_TEST );
		return;
	case GR_DEPTHBUFFER_ZBUFFER:
	case GR_DEPTHBUFFER_ZBUFFER_COMPARE_TO_BIAS:
		OpenGL.ZNear = ZBUFFERNEAR;
		OpenGL.ZFar = ZBUFFERFAR;
		break;
	case GR_DEPTHBUFFER_WBUFFER:
	case GR_DEPTHBUFFER_WBUFFER_COMPARE_TO_BIAS:
		OpenGL.ZNear = WBUFFERNEAR;
		OpenGL.ZFar = WBUFFERFAR;
		break;
	}

	glEnable( GL_DEPTH_TEST );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();

	if (Glide.State.OriginInformation == GR_ORIGIN_LOWER_LEFT)
	{
		glOrtho( 0, Glide.WindowWidth, 0, Glide.WindowHeight, OpenGL.ZNear, OpenGL.ZFar );
	}
	else
	{
		glOrtho( 0, Glide.WindowWidth, Glide.WindowHeight, 0, OpenGL.ZNear, OpenGL.ZFar );
	}
	glViewport( 0,0, OpenGL.WindowWidth, OpenGL.WindowHeight );	

	glMatrixMode( GL_MODELVIEW );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBufferMode" );
#endif
}

//*************************************************
//* Enables or Disables Depth Buffer Writting
//*************************************************
DLLEXPORT void __stdcall
grDepthMask( FxBool enable )
{
#ifdef DONE
	GlideMsg( "grDepthMask( %d )\n", enable );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBufferWritting = enable;

	if (Glide.State.DepthBufferWritting == FXFALSE)
		OpenGL.DepthBufferWritting = GL_FALSE;
	else
		OpenGL.DepthBufferWritting = GL_TRUE;

	glDepthMask( OpenGL.DepthBufferWritting );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthMask" );
#endif
}

//*************************************************
//* Sets the Depth Function to use
//*************************************************
DLLEXPORT void __stdcall
grDepthBufferFunction( GrCmpFnc_t func )
{
#ifdef DONE
	GlideMsg( "grDepthBufferFunction( %d )\n", func );
#endif

	RenderDrawTriangles();

	Glide.State.DepthFunction = func;
	switch ( func )
	{
	case GR_CMP_NEVER:		OpenGL.DepthFunction = GL_NEVER;		break;
	case GR_CMP_LESS:		OpenGL.DepthFunction = GL_LESS;			break;
	case GR_CMP_EQUAL: 		OpenGL.DepthFunction = GL_EQUAL;		break;
	case GR_CMP_LEQUAL: 	OpenGL.DepthFunction = GL_LEQUAL;		break;
	case GR_CMP_GREATER: 	OpenGL.DepthFunction = GL_GREATER;		break;
	case GR_CMP_NOTEQUAL: 	OpenGL.DepthFunction = GL_NOTEQUAL;		break;
	case GR_CMP_GEQUAL: 	OpenGL.DepthFunction = GL_GEQUAL;		break;
	case GR_CMP_ALWAYS:		OpenGL.DepthFunction = GL_ALWAYS;		break;
	}

	glDepthFunc( OpenGL.DepthFunction );

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBufferFunction" );
#endif
}

//*************************************************
//* Set the depth bias level
//*************************************************
DLLEXPORT void __stdcall
grDepthBiasLevel( FxI16 level )
{
#ifdef PARTDONE
	GlideMsg( "grDepthBiasLevel( %d )\n", level );
#endif

	RenderDrawTriangles();

	Glide.State.DepthBiasLevel = level;
	//OpenGL.DepthBiasLevel = level * D1OVER65536;
	OpenGL.DepthBiasLevel = level * 10.0f;

	glPolygonOffset( 1.0f, OpenGL.DepthBiasLevel );

	if ( level != 0 )
	{
		glEnable( GL_POLYGON_OFFSET_FILL );
	}
	else
	{
		glDisable( GL_POLYGON_OFFSET_FILL );
	}

#ifdef OPENGL_DEBUG
	GLErro( "grDepthBiasLevel" );
#endif
}

{'fraction_non_alphanumeric': 0.23343636607982798, 'fraction_numerical': 0.004972449939524257, 'mean_word_length': 5.426597582037997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2677410', 'n_tokens_mistral': 2830, 'n_tokens_neox': 2618, 'n_words': 504}