npcs and tutorial stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / impl.c
index 0bc64bb9d19dfde3955c2ce1fb22ab3b5d901c1c..01e1b84ebd047bc3ffe6aa2554df9161d4808ebd 100644 (file)
@@ -9084,15 +9084,18 @@ struct vg_shader _shader_model_character_view = {
 "uniform sampler2D uTexSceneDepth;\n"
 "uniform vec3 uInverseRatioDepth;\n"
 "uniform vec3 uInverseRatioMain;\n"
-"uniform bool uDepthCompare;\n"
+"uniform int uDepthMode;\n"
+"uniform float uDitherCutoff;\n"
 "\n"
 "float linear_depth( float depth, float near, float far ) {\n"
 "   float z = depth * 2.0 - 1.0;\n"
 "   return (2.0 * near * far) / (far + near - z * (far - near));       \n"
 "}\n"
 "\n"
-"void depth_compare_dither(){\n"
-"   if( uDepthCompare ){\n"
+"void depth_compare_dither()\n"
+"{\n"
+"   if( uDepthMode == 1 )\n"
+"   {\n"
 "      vec2 back_coord = gl_FragCoord.xy * uInverseRatioMain.xy \n"
 "                                        * uInverseRatioDepth.xy;\n"
 "      float back_depth = texture( uTexSceneDepth, back_coord ).r;\n"
@@ -9108,6 +9111,14 @@ struct vg_shader _shader_model_character_view = {
 "      if( step(0.0,diff)+dither<0.3 )\n"
 "         discard;\n"
 "   }\n"
+"\n"
+"   if( uDepthMode == 2 )\n"
+"   {\n"
+"      vec2 ssuv = gl_FragCoord.xy;\n"
+"      vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );\n"
+"      float dither = fract( vDither.g / 71.0 );\n"
+"      if( dither<uDitherCutoff ) discard;\n"
+"   }\n"
 "}\n"
 "\n"
 "#line     14        0 \n"
@@ -9219,7 +9230,8 @@ GLuint _uniform_model_character_view_uLightsIndex;
 GLuint _uniform_model_character_view_uTexSceneDepth;
 GLuint _uniform_model_character_view_uInverseRatioDepth;
 GLuint _uniform_model_character_view_uInverseRatioMain;
-GLuint _uniform_model_character_view_uDepthCompare;
+GLuint _uniform_model_character_view_uDepthMode;
+GLuint _uniform_model_character_view_uDitherCutoff;
 #include "shaders/model_board_view.h"
 struct vg_shader _shader_model_board_view = {
    .name = "model_board_view",
@@ -9656,15 +9668,18 @@ struct vg_shader _shader_model_board_view = {
 "uniform sampler2D uTexSceneDepth;\n"
 "uniform vec3 uInverseRatioDepth;\n"
 "uniform vec3 uInverseRatioMain;\n"
-"uniform bool uDepthCompare;\n"
+"uniform int uDepthMode;\n"
+"uniform float uDitherCutoff;\n"
 "\n"
 "float linear_depth( float depth, float near, float far ) {\n"
 "   float z = depth * 2.0 - 1.0;\n"
 "   return (2.0 * near * far) / (far + near - z * (far - near));       \n"
 "}\n"
 "\n"
-"void depth_compare_dither(){\n"
-"   if( uDepthCompare ){\n"
+"void depth_compare_dither()\n"
+"{\n"
+"   if( uDepthMode == 1 )\n"
+"   {\n"
 "      vec2 back_coord = gl_FragCoord.xy * uInverseRatioMain.xy \n"
 "                                        * uInverseRatioDepth.xy;\n"
 "      float back_depth = texture( uTexSceneDepth, back_coord ).r;\n"
@@ -9680,6 +9695,14 @@ struct vg_shader _shader_model_board_view = {
 "      if( step(0.0,diff)+dither<0.3 )\n"
 "         discard;\n"
 "   }\n"
+"\n"
+"   if( uDepthMode == 2 )\n"
+"   {\n"
+"      vec2 ssuv = gl_FragCoord.xy;\n"
+"      vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );\n"
+"      float dither = fract( vDither.g / 71.0 );\n"
+"      if( dither<uDitherCutoff ) discard;\n"
+"   }\n"
 "}\n"
 "\n"
 "#line     14        0 \n"
@@ -9792,7 +9815,8 @@ GLuint _uniform_model_board_view_uLightsIndex;
 GLuint _uniform_model_board_view_uTexSceneDepth;
 GLuint _uniform_model_board_view_uInverseRatioDepth;
 GLuint _uniform_model_board_view_uInverseRatioMain;
-GLuint _uniform_model_board_view_uDepthCompare;
+GLuint _uniform_model_board_view_uDepthMode;
+GLuint _uniform_model_board_view_uDitherCutoff;
 #include "shaders/model_entity.h"
 struct vg_shader _shader_model_entity = {
    .name = "model_entity",
@@ -10573,15 +10597,18 @@ struct vg_shader _shader_model_font = {
 "uniform sampler2D uTexSceneDepth;\n"
 "uniform vec3 uInverseRatioDepth;\n"
 "uniform vec3 uInverseRatioMain;\n"
-"uniform bool uDepthCompare;\n"
+"uniform int uDepthMode;\n"
+"uniform float uDitherCutoff;\n"
 "\n"
 "float linear_depth( float depth, float near, float far ) {\n"
 "   float z = depth * 2.0 - 1.0;\n"
 "   return (2.0 * near * far) / (far + near - z * (far - near));       \n"
 "}\n"
 "\n"
-"void depth_compare_dither(){\n"
-"   if( uDepthCompare ){\n"
+"void depth_compare_dither()\n"
+"{\n"
+"   if( uDepthMode == 1 )\n"
+"   {\n"
 "      vec2 back_coord = gl_FragCoord.xy * uInverseRatioMain.xy \n"
 "                                        * uInverseRatioDepth.xy;\n"
 "      float back_depth = texture( uTexSceneDepth, back_coord ).r;\n"
@@ -10597,6 +10624,14 @@ struct vg_shader _shader_model_font = {
 "      if( step(0.0,diff)+dither<0.3 )\n"
 "         discard;\n"
 "   }\n"
+"\n"
+"   if( uDepthMode == 2 )\n"
+"   {\n"
+"      vec2 ssuv = gl_FragCoord.xy;\n"
+"      vec3 vDither = vec3( dot( vec2( 171.0, 231.0 ), ssuv) );\n"
+"      float dither = fract( vDither.g / 71.0 );\n"
+"      if( dither<uDitherCutoff ) discard;\n"
+"   }\n"
 "}\n"
 "\n"
 "#line     12        0 \n"
@@ -10618,7 +10653,8 @@ GLuint _uniform_model_font_uColour;
 GLuint _uniform_model_font_uTexSceneDepth;
 GLuint _uniform_model_font_uInverseRatioDepth;
 GLuint _uniform_model_font_uInverseRatioMain;
-GLuint _uniform_model_font_uDepthCompare;
+GLuint _uniform_model_font_uDepthMode;
+GLuint _uniform_model_font_uDitherCutoff;
 #include "shaders/particle.h"
 struct vg_shader _shader_particle = {
    .name = "particle",
@@ -11261,7 +11297,8 @@ void vg_auto_shader_link(void)
    _uniform_model_character_view_uTexSceneDepth = glGetUniformLocation( _shader_model_character_view.id, "uTexSceneDepth" );
    _uniform_model_character_view_uInverseRatioDepth = glGetUniformLocation( _shader_model_character_view.id, "uInverseRatioDepth" );
    _uniform_model_character_view_uInverseRatioMain = glGetUniformLocation( _shader_model_character_view.id, "uInverseRatioMain" );
-   _uniform_model_character_view_uDepthCompare = glGetUniformLocation( _shader_model_character_view.id, "uDepthCompare" );
+   _uniform_model_character_view_uDepthMode = glGetUniformLocation( _shader_model_character_view.id, "uDepthMode" );
+   _uniform_model_character_view_uDitherCutoff = glGetUniformLocation( _shader_model_character_view.id, "uDitherCutoff" );
    _uniform_model_board_view_uMdl = glGetUniformLocation( _shader_model_board_view.id, "uMdl" );
    _uniform_model_board_view_uPv = glGetUniformLocation( _shader_model_board_view.id, "uPv" );
    _uniform_model_board_view_uPvmPrev = glGetUniformLocation( _shader_model_board_view.id, "uPvmPrev" );
@@ -11273,7 +11310,8 @@ void vg_auto_shader_link(void)
    _uniform_model_board_view_uTexSceneDepth = glGetUniformLocation( _shader_model_board_view.id, "uTexSceneDepth" );
    _uniform_model_board_view_uInverseRatioDepth = glGetUniformLocation( _shader_model_board_view.id, "uInverseRatioDepth" );
    _uniform_model_board_view_uInverseRatioMain = glGetUniformLocation( _shader_model_board_view.id, "uInverseRatioMain" );
-   _uniform_model_board_view_uDepthCompare = glGetUniformLocation( _shader_model_board_view.id, "uDepthCompare" );
+   _uniform_model_board_view_uDepthMode = glGetUniformLocation( _shader_model_board_view.id, "uDepthMode" );
+   _uniform_model_board_view_uDitherCutoff = glGetUniformLocation( _shader_model_board_view.id, "uDitherCutoff" );
    _uniform_model_entity_uMdl = glGetUniformLocation( _shader_model_entity.id, "uMdl" );
    _uniform_model_entity_uPv = glGetUniformLocation( _shader_model_entity.id, "uPv" );
    _uniform_model_entity_uPvmPrev = glGetUniformLocation( _shader_model_entity.id, "uPvmPrev" );
@@ -11304,7 +11342,8 @@ void vg_auto_shader_link(void)
    _uniform_model_font_uTexSceneDepth = glGetUniformLocation( _shader_model_font.id, "uTexSceneDepth" );
    _uniform_model_font_uInverseRatioDepth = glGetUniformLocation( _shader_model_font.id, "uInverseRatioDepth" );
    _uniform_model_font_uInverseRatioMain = glGetUniformLocation( _shader_model_font.id, "uInverseRatioMain" );
-   _uniform_model_font_uDepthCompare = glGetUniformLocation( _shader_model_font.id, "uDepthCompare" );
+   _uniform_model_font_uDepthMode = glGetUniformLocation( _shader_model_font.id, "uDepthMode" );
+   _uniform_model_font_uDitherCutoff = glGetUniformLocation( _shader_model_font.id, "uDitherCutoff" );
    _uniform_particle_uPv = glGetUniformLocation( _shader_particle.id, "uPv" );
    _uniform_particle_uPvPrev = glGetUniformLocation( _shader_particle.id, "uPvPrev" );
    _uniform_trail_uPv = glGetUniformLocation( _shader_trail.id, "uPv" );