mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Fix GLES shader precision issues (#14516)
This commit is contained in:
parent
0ea1ec31fc
commit
a9a0f1e129
@ -1,7 +1,7 @@
|
|||||||
uniform vec4 fogColor;
|
uniform lowp vec4 fogColor;
|
||||||
uniform float fogDistance;
|
uniform float fogDistance;
|
||||||
uniform float fogShadingParameter;
|
uniform float fogShadingParameter;
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
|
|
||||||
varying lowp vec4 varColor;
|
varying lowp vec4 varColor;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
uniform vec4 emissiveColor;
|
uniform lowp vec4 emissiveColor;
|
||||||
|
|
||||||
varying lowp vec4 varColor;
|
varying lowp vec4 varColor;
|
||||||
|
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
uniform sampler2D baseTexture;
|
uniform sampler2D baseTexture;
|
||||||
|
|
||||||
uniform vec3 dayLight;
|
uniform vec3 dayLight;
|
||||||
uniform vec4 fogColor;
|
uniform lowp vec4 fogColor;
|
||||||
uniform float fogDistance;
|
uniform float fogDistance;
|
||||||
uniform float fogShadingParameter;
|
uniform float fogShadingParameter;
|
||||||
uniform vec3 eyePosition;
|
|
||||||
|
|
||||||
// The cameraOffset is the current center of the visible world.
|
// The cameraOffset is the current center of the visible world.
|
||||||
uniform vec3 cameraOffset;
|
uniform highp vec3 cameraOffset;
|
||||||
uniform float animationTimer;
|
uniform float animationTimer;
|
||||||
#ifdef ENABLE_DYNAMIC_SHADOWS
|
#ifdef ENABLE_DYNAMIC_SHADOWS
|
||||||
// shadow texture
|
// shadow texture
|
||||||
@ -44,11 +43,8 @@ varying mediump vec2 varTexCoord;
|
|||||||
#else
|
#else
|
||||||
centroid varying vec2 varTexCoord;
|
centroid varying vec2 varTexCoord;
|
||||||
#endif
|
#endif
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
varying float nightRatio;
|
varying float nightRatio;
|
||||||
varying vec3 tsEyeVec;
|
|
||||||
varying vec3 lightVec;
|
|
||||||
varying vec3 tsLightVec;
|
|
||||||
|
|
||||||
#ifdef ENABLE_DYNAMIC_SHADOWS
|
#ifdef ENABLE_DYNAMIC_SHADOWS
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
uniform mat4 mWorld;
|
uniform mat4 mWorld;
|
||||||
// Color of the light emitted by the sun.
|
// Color of the light emitted by the sun.
|
||||||
uniform vec3 dayLight;
|
uniform vec3 dayLight;
|
||||||
uniform vec3 eyePosition;
|
|
||||||
|
|
||||||
// The cameraOffset is the current center of the visible world.
|
// The cameraOffset is the current center of the visible world.
|
||||||
uniform vec3 cameraOffset;
|
uniform highp vec3 cameraOffset;
|
||||||
uniform float animationTimer;
|
uniform float animationTimer;
|
||||||
|
|
||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
@ -44,7 +43,7 @@ centroid varying vec2 varTexCoord;
|
|||||||
|
|
||||||
varying float area_enable_parallax;
|
varying float area_enable_parallax;
|
||||||
|
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
varying float nightRatio;
|
varying float nightRatio;
|
||||||
// Color of the light emitted by the light sources.
|
// Color of the light emitted by the light sources.
|
||||||
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);
|
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
uniform sampler2D baseTexture;
|
uniform sampler2D baseTexture;
|
||||||
|
|
||||||
uniform vec3 dayLight;
|
uniform vec3 dayLight;
|
||||||
uniform vec4 fogColor;
|
uniform lowp vec4 fogColor;
|
||||||
uniform float fogDistance;
|
uniform float fogDistance;
|
||||||
uniform float fogShadingParameter;
|
uniform float fogShadingParameter;
|
||||||
uniform vec3 eyePosition;
|
|
||||||
|
|
||||||
// The cameraOffset is the current center of the visible world.
|
// The cameraOffset is the current center of the visible world.
|
||||||
uniform vec3 cameraOffset;
|
uniform highp vec3 cameraOffset;
|
||||||
uniform float animationTimer;
|
uniform float animationTimer;
|
||||||
#ifdef ENABLE_DYNAMIC_SHADOWS
|
#ifdef ENABLE_DYNAMIC_SHADOWS
|
||||||
// shadow texture
|
// shadow texture
|
||||||
@ -44,7 +43,7 @@ varying mediump vec2 varTexCoord;
|
|||||||
#else
|
#else
|
||||||
centroid varying vec2 varTexCoord;
|
centroid varying vec2 varTexCoord;
|
||||||
#endif
|
#endif
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
varying float nightRatio;
|
varying float nightRatio;
|
||||||
|
|
||||||
varying float vIDiff;
|
varying float vIDiff;
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
uniform mat4 mWorld;
|
uniform mat4 mWorld;
|
||||||
uniform vec3 dayLight;
|
uniform vec3 dayLight;
|
||||||
uniform vec3 eyePosition;
|
|
||||||
uniform float animationTimer;
|
uniform float animationTimer;
|
||||||
uniform vec4 emissiveColor;
|
uniform lowp vec4 emissiveColor;
|
||||||
uniform vec3 cameraOffset;
|
|
||||||
|
|
||||||
|
|
||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
varying vec3 vPosition;
|
varying vec3 vPosition;
|
||||||
@ -33,7 +30,7 @@ centroid varying vec2 varTexCoord;
|
|||||||
varying float perspective_factor;
|
varying float perspective_factor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
varying vec3 eyeVec;
|
varying highp vec3 eyeVec;
|
||||||
varying float nightRatio;
|
varying float nightRatio;
|
||||||
// Color of the light emitted by the light sources.
|
// Color of the light emitted by the light sources.
|
||||||
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);
|
const vec3 artificialLight = vec3(1.04, 1.04, 1.04);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
uniform vec4 emissiveColor;
|
uniform lowp vec4 emissiveColor;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
|
@ -381,11 +381,9 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
|||||||
CachedPixelShaderSetting<float>
|
CachedPixelShaderSetting<float>
|
||||||
m_animation_timer_delta_pixel{"animationTimerDelta"};
|
m_animation_timer_delta_pixel{"animationTimerDelta"};
|
||||||
CachedPixelShaderSetting<float, 3> m_day_light{"dayLight"};
|
CachedPixelShaderSetting<float, 3> m_day_light{"dayLight"};
|
||||||
CachedPixelShaderSetting<float, 3> m_eye_position_pixel{"eyePosition"};
|
|
||||||
CachedVertexShaderSetting<float, 3> m_eye_position_vertex{"eyePosition"};
|
|
||||||
CachedPixelShaderSetting<float, 3> m_minimap_yaw{"yawVec"};
|
CachedPixelShaderSetting<float, 3> m_minimap_yaw{"yawVec"};
|
||||||
CachedPixelShaderSetting<float, 3> m_camera_offset_pixel{"cameraOffset"};
|
CachedPixelShaderSetting<float, 3> m_camera_offset_pixel{"cameraOffset"};
|
||||||
CachedPixelShaderSetting<float, 3> m_camera_offset_vertex{"cameraOffset"};
|
CachedVertexShaderSetting<float, 3> m_camera_offset_vertex{"cameraOffset"};
|
||||||
CachedPixelShaderSetting<SamplerLayer_t> m_texture0{"texture0"};
|
CachedPixelShaderSetting<SamplerLayer_t> m_texture0{"texture0"};
|
||||||
CachedPixelShaderSetting<SamplerLayer_t> m_texture1{"texture1"};
|
CachedPixelShaderSetting<SamplerLayer_t> m_texture1{"texture1"};
|
||||||
CachedPixelShaderSetting<SamplerLayer_t> m_texture2{"texture2"};
|
CachedPixelShaderSetting<SamplerLayer_t> m_texture2{"texture2"};
|
||||||
@ -483,10 +481,6 @@ public:
|
|||||||
m_animation_timer_delta_vertex.set(&animation_timer_delta_f, services);
|
m_animation_timer_delta_vertex.set(&animation_timer_delta_f, services);
|
||||||
m_animation_timer_delta_pixel.set(&animation_timer_delta_f, services);
|
m_animation_timer_delta_pixel.set(&animation_timer_delta_f, services);
|
||||||
|
|
||||||
v3f epos = m_client->getEnv().getLocalPlayer()->getEyePosition();
|
|
||||||
m_eye_position_pixel.set(epos, services);
|
|
||||||
m_eye_position_vertex.set(epos, services);
|
|
||||||
|
|
||||||
if (m_client->getMinimap()) {
|
if (m_client->getMinimap()) {
|
||||||
v3f minimap_yaw = m_client->getMinimap()->getYawVec();
|
v3f minimap_yaw = m_client->getMinimap()->getYawVec();
|
||||||
m_minimap_yaw.set(minimap_yaw, services);
|
m_minimap_yaw.set(minimap_yaw, services);
|
||||||
|
Loading…
Reference in New Issue
Block a user