mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 06:02:23 +01:00
parent
700fbc803d
commit
d6da80fe24
@ -8,11 +8,7 @@ void main(void)
|
|||||||
{
|
{
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
|
||||||
#ifdef GL_ES
|
|
||||||
vec4 color = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
vec4 color = inVertexColor;
|
vec4 color = inVertexColor;
|
||||||
#endif
|
|
||||||
|
|
||||||
color *= materialColor;
|
color *= materialColor;
|
||||||
varColor = color;
|
varColor = color;
|
||||||
|
@ -3,9 +3,5 @@ varying lowp vec4 varColor;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
#ifdef GL_ES
|
|
||||||
varColor = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,5 @@ void main(void)
|
|||||||
{
|
{
|
||||||
varTexCoord = inTexCoord0.st;
|
varTexCoord = inTexCoord0.st;
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
#ifdef GL_ES
|
|
||||||
varColor = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -199,15 +199,11 @@ void main(void)
|
|||||||
vNormal = inVertexNormal;
|
vNormal = inVertexNormal;
|
||||||
|
|
||||||
// Calculate color.
|
// Calculate color.
|
||||||
|
vec4 color = inVertexColor;
|
||||||
// Red, green and blue components are pre-multiplied with
|
// Red, green and blue components are pre-multiplied with
|
||||||
// the brightness, so now we have to multiply these
|
// the brightness, so now we have to multiply these
|
||||||
// colors with the color of the incoming light.
|
// colors with the color of the incoming light.
|
||||||
// The pre-baked colors are halved to prevent overflow.
|
// The pre-baked colors are halved to prevent overflow.
|
||||||
#ifdef GL_ES
|
|
||||||
vec4 color = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
vec4 color = inVertexColor;
|
|
||||||
#endif
|
|
||||||
// The alpha gives the ratio of sunlight in the incoming light.
|
// The alpha gives the ratio of sunlight in the incoming light.
|
||||||
nightRatio = 1.0 - color.a;
|
nightRatio = 1.0 - color.a;
|
||||||
color.rgb = color.rgb * (color.a * dayLight.rgb +
|
color.rgb = color.rgb * (color.a * dayLight.rgb +
|
||||||
|
@ -109,11 +109,7 @@ void main(void)
|
|||||||
: directional_ambient(normalize(inVertexNormal));
|
: directional_ambient(normalize(inVertexNormal));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GL_ES
|
|
||||||
vec4 color = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
vec4 color = inVertexColor;
|
vec4 color = inVertexColor;
|
||||||
#endif
|
|
||||||
|
|
||||||
color *= materialColor;
|
color *= materialColor;
|
||||||
|
|
||||||
|
@ -6,9 +6,5 @@ void main(void)
|
|||||||
varTexCoord = inTexCoord0.st;
|
varTexCoord = inTexCoord0.st;
|
||||||
gl_Position = mWorldViewProj * inVertexPosition;
|
gl_Position = mWorldViewProj * inVertexPosition;
|
||||||
|
|
||||||
#ifdef GL_ES
|
|
||||||
varColor = inVertexColor.bgra;
|
|
||||||
#else
|
|
||||||
varColor = inVertexColor;
|
varColor = inVertexColor;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
|
|
||||||
// Create shaders header
|
// Create shaders header
|
||||||
bool fully_programmable = driver->getDriverType() == video::EDT_OGLES2 || driver->getDriverType() == video::EDT_OPENGL3;
|
bool fully_programmable = driver->getDriverType() == video::EDT_OGLES2 || driver->getDriverType() == video::EDT_OPENGL3;
|
||||||
std::stringstream shaders_header;
|
std::ostringstream shaders_header;
|
||||||
shaders_header
|
shaders_header
|
||||||
<< std::noboolalpha
|
<< std::noboolalpha
|
||||||
<< std::showpoint // for GLSL ES
|
<< std::showpoint // for GLSL ES
|
||||||
@ -588,10 +588,14 @@ ShaderInfo ShaderSource::generateShader(const std::string &name,
|
|||||||
attribute mediump vec4 inVertexTangent;
|
attribute mediump vec4 inVertexTangent;
|
||||||
attribute mediump vec4 inVertexBinormal;
|
attribute mediump vec4 inVertexBinormal;
|
||||||
)";
|
)";
|
||||||
|
// Our vertex color has components reversed compared to what OpenGL
|
||||||
|
// normally expects, so we need to take that into account.
|
||||||
|
vertex_header += "#define inVertexColor (inVertexColor.bgra)\n";
|
||||||
fragment_header = R"(
|
fragment_header = R"(
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
)";
|
)";
|
||||||
} else {
|
} else {
|
||||||
|
/* legacy OpenGL driver */
|
||||||
shaders_header << R"(
|
shaders_header << R"(
|
||||||
#version 120
|
#version 120
|
||||||
#define lowp
|
#define lowp
|
||||||
|
Loading…
Reference in New Issue
Block a user