Updated shaders using latest OpenSceneGraph-Data/shader versions
This commit is contained in:
@@ -16,10 +16,12 @@ char text_greyscale_frag[] = "$OSG_GLSL_VERSION\n"
|
||||
"$OSG_VARYING_IN vec2 texCoord;\n"
|
||||
"$OSG_VARYING_IN vec4 vertexColor;\n"
|
||||
"\n"
|
||||
"#if !defined(GL_ES) && __VERSION__>=130\n"
|
||||
" #define ALPHA r\n"
|
||||
"#else\n"
|
||||
" #define ALPHA a\n"
|
||||
"#ifndef ALPHA\n"
|
||||
" #if !defined(GL_ES) && __VERSION__>=130\n"
|
||||
" #define ALPHA r\n"
|
||||
" #else\n"
|
||||
" #define ALPHA a\n"
|
||||
" #endif\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"void main(void)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
|
||||
" #extension GL_ARB_texture_query_lod : enable\n"
|
||||
" #ifdef GL_ARB_texture_query_lod\n"
|
||||
" #define osg_TextureQueryLOD textureQueryLOD\n"
|
||||
" #define USE_SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
" #define SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
" #endif\n"
|
||||
" #endif\n"
|
||||
" #endif\n"
|
||||
@@ -42,16 +42,15 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
|
||||
" // glyph.rgba = (signed_distance, thin_outline, thick_outline, glyph_alpha)\n"
|
||||
" vec4 glyph = TEXTURE(glyphTexture, texCoord);\n"
|
||||
"\n"
|
||||
" #if 1\n"
|
||||
" float blend_ratio = OUTLINE*17.0;\n"
|
||||
" #ifdef SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
" float blend_ratio = OUTLINE*20.0; // assume inner boundary starts at OUTLINE==0.05\n"
|
||||
"\n"
|
||||
" float outline_alpha = 0.0;\n"
|
||||
" if (blend_ratio>2.0) outline_alpha = glyph.b;\n"
|
||||
" else if (blend_ratio>1.0) outline_alpha = mix(glyph.g, glyph.b, blend_ratio-1.0);\n"
|
||||
" else outline_alpha = glyph.g*blend_ratio;\n"
|
||||
" #else\n"
|
||||
" float outline_alpha = glyph.g;\n"
|
||||
" //float outline_alpha = glyph.b;\n"
|
||||
" float outline_alpha = (OUTLINE<=0.075) ? glyph.g : glyph.b;\n"
|
||||
" #endif\n"
|
||||
"\n"
|
||||
" float alpha = glyph.a+outline_alpha;\n"
|
||||
@@ -66,17 +65,17 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
|
||||
" #endif\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"#ifdef USE_SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
"#ifdef SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
"vec4 distanceFieldColor()\n"
|
||||
"{\n"
|
||||
" float center_alpha = TEXTURE(glyphTexture, texCoord).r;\n"
|
||||
"\n"
|
||||
" float blend_width = 0.2;\n"
|
||||
" float distance_scale = 5.0;\n"
|
||||
" float blend_width = 0.005;\n"
|
||||
" float distance_scale = 0.25;\n"
|
||||
" float edge_distance = (center_alpha-0.5)*distance_scale;\n"
|
||||
"\n"
|
||||
" #ifdef OUTLINE\n"
|
||||
" float outline_width = OUTLINE*17.0;//0.5;\n"
|
||||
" float outline_width = OUTLINE*0.5;;\n"
|
||||
" if (edge_distance>blend_width*0.5)\n"
|
||||
" {\n"
|
||||
" return vertexColor;\n"
|
||||
@@ -118,12 +117,12 @@ char text_sdf_frag[] = "$OSG_GLSL_VERSION\n"
|
||||
"void main(void)\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"#ifdef USE_SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
"#ifdef SIGNED_DISTNACE_FIELD_SUPPORTED\n"
|
||||
"\n"
|
||||
" float mml = osg_TextureQueryLOD(glyphTexture, texCoord).x;\n"
|
||||
"\n"
|
||||
" float near_transition = 0.0;\n"
|
||||
" float far_transition = 1.0;\n"
|
||||
" float far_transition = near_transition+1.0;\n"
|
||||
"\n"
|
||||
" vec4 color;\n"
|
||||
" if (mml<near_transition) color = distanceFieldColor();\n"
|
||||
|
||||
Reference in New Issue
Block a user