mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
glgsg: Correctly handle 4-component texcoords in default shader
This commit is contained in:
parent
67c413f089
commit
7a8e218da7
@ -171,23 +171,23 @@ static const string default_vshader =
|
||||
#endif
|
||||
"in vec4 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in vec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in vec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
#else
|
||||
"#version 100\n"
|
||||
"precision mediump float;\n"
|
||||
"attribute vec4 p3d_Vertex;\n"
|
||||
"attribute vec4 p3d_Color;\n"
|
||||
"attribute vec2 p3d_MultiTexCoord0;\n"
|
||||
"varying vec2 texcoord;\n"
|
||||
"attribute vec4 p3d_MultiTexCoord0;\n"
|
||||
"varying vec3 texcoord;\n"
|
||||
"varying lowp vec4 color;\n"
|
||||
#endif
|
||||
"uniform mat4 p3d_ModelViewProjectionMatrix;\n"
|
||||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
|
||||
" texcoord = p3d_MultiTexCoord0;\n"
|
||||
" texcoord = p3d_MultiTexCoord0.xyw;\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
|
||||
@ -203,15 +203,15 @@ static const string default_vshader_fp64 =
|
||||
"#extension GL_ARB_gpu_shader_fp64 : require\n"
|
||||
"in dvec3 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in dvec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in dvec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
"uniform mat4 p3d_ModelViewMatrix;\n"
|
||||
"uniform mat4 p3d_ProjectionMatrix;\n"
|
||||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n" // Apply proj & modelview in two steps, more precise
|
||||
" gl_Position = vec4(dmat4(p3d_ProjectionMatrix) * (dmat4(p3d_ModelViewMatrix) * dvec4(p3d_Vertex, 1)));\n"
|
||||
" texcoord = vec2(p3d_MultiTexCoord0);\n"
|
||||
" texcoord = vec3(p3d_MultiTexCoord0.xyw);\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
|
||||
@ -220,15 +220,15 @@ static const string default_vshader_fp64_gl41 =
|
||||
"#version 410\n"
|
||||
"in dvec3 p3d_Vertex;\n"
|
||||
"in vec4 p3d_Color;\n"
|
||||
"in dvec2 p3d_MultiTexCoord0;\n"
|
||||
"out vec2 texcoord;\n"
|
||||
"in dvec4 p3d_MultiTexCoord0;\n"
|
||||
"out vec3 texcoord;\n"
|
||||
"out vec4 color;\n"
|
||||
"uniform mat4 p3d_ModelViewMatrix;\n"
|
||||
"uniform mat4 p3d_ProjectionMatrix;\n"
|
||||
"uniform vec4 p3d_ColorScale;\n"
|
||||
"void main(void) {\n" // Apply proj & modelview in two steps, more precise
|
||||
" gl_Position = vec4(dmat4(p3d_ProjectionMatrix) * (dmat4(p3d_ModelViewMatrix) * dvec4(p3d_Vertex, 1)));\n"
|
||||
" texcoord = vec2(p3d_MultiTexCoord0);\n"
|
||||
" texcoord = vec3(p3d_MultiTexCoord0.xyw);\n"
|
||||
" color = p3d_Color * p3d_ColorScale;\n"
|
||||
"}\n";
|
||||
#endif
|
||||
@ -240,7 +240,7 @@ static const string default_fshader =
|
||||
#else
|
||||
"#version 130\n"
|
||||
#endif
|
||||
"in vec2 texcoord;\n"
|
||||
"in vec3 texcoord;\n"
|
||||
"in vec4 color;\n"
|
||||
"out vec4 p3d_FragColor;\n"
|
||||
"uniform sampler2D p3d_Texture0;\n"
|
||||
@ -248,18 +248,18 @@ static const string default_fshader =
|
||||
#else
|
||||
"#version 100\n"
|
||||
"precision mediump float;\n"
|
||||
"varying vec2 texcoord;\n"
|
||||
"varying vec3 texcoord;\n"
|
||||
"varying lowp vec4 color;\n"
|
||||
"uniform lowp sampler2D p3d_Texture0;\n"
|
||||
"uniform lowp vec4 p3d_TexAlphaOnly;\n"
|
||||
#endif
|
||||
"void main(void) {\n"
|
||||
#ifndef OPENGLES
|
||||
" p3d_FragColor = texture(p3d_Texture0, texcoord);\n"
|
||||
" p3d_FragColor = textureProj(p3d_Texture0, texcoord);\n"
|
||||
" p3d_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
||||
" p3d_FragColor *= color;\n"
|
||||
#else
|
||||
" gl_FragColor = texture2D(p3d_Texture0, texcoord);\n"
|
||||
" gl_FragColor = texture2DProj(p3d_Texture0, texcoord);\n"
|
||||
" gl_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
||||
" gl_FragColor *= color;\n"
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user