TIME constant reverted to a single float, fixes #9123

This commit is contained in:
Juan Linietsky 2017-06-16 08:29:43 -03:00
parent 5d02b948a9
commit 80929d36be
9 changed files with 11 additions and 17 deletions

View File

@ -1265,9 +1265,7 @@ void RasterizerCanvasGLES3::reset_canvas() {
state.vp = canvas_transform; state.vp = canvas_transform;
store_transform(canvas_transform, state.canvas_item_ubo_data.projection_matrix); store_transform(canvas_transform, state.canvas_item_ubo_data.projection_matrix);
for (int i = 0; i < 4; i++) { state.canvas_item_ubo_data.time = storage->frame.time[0];
state.canvas_item_ubo_data.time[i] = storage->frame.time[i];
}
glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo);
glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data); glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data);

View File

@ -39,7 +39,7 @@ public:
struct CanvasItemUBO { struct CanvasItemUBO {
float projection_matrix[16]; float projection_matrix[16];
float time[4]; float time;
}; };
struct Data { struct Data {

View File

@ -2314,9 +2314,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr
store_transform(p_cam_transform.affine_inverse(), state.ubo_data.camera_inverse_matrix); store_transform(p_cam_transform.affine_inverse(), state.ubo_data.camera_inverse_matrix);
//time global variables //time global variables
for (int i = 0; i < 4; i++) { state.ubo_data.time = storage->frame.time[0];
state.ubo_data.time[i] = storage->frame.time[i];
}
state.ubo_data.z_far = p_cam_projection.get_z_far(); state.ubo_data.z_far = p_cam_projection.get_z_far();
//bg and ambient //bg and ambient

View File

@ -111,7 +111,6 @@ public:
float projection_matrix[16]; float projection_matrix[16];
float camera_inverse_matrix[16]; float camera_inverse_matrix[16];
float camera_matrix[16]; float camera_matrix[16];
float time[4];
float ambient_light_color[4]; float ambient_light_color[4];
float bg_color[4]; float bg_color[4];
float fog_color_enabled[4]; float fog_color_enabled[4];
@ -127,6 +126,7 @@ public:
float shadow_atlas_pixel_size[2]; float shadow_atlas_pixel_size[2];
float shadow_directional_pixel_size[2]; float shadow_directional_pixel_size[2];
float time;
float z_far; float z_far;
float reflection_multiplier; float reflection_multiplier;
float subsurface_scatter_width; float subsurface_scatter_width;

View File

@ -5381,7 +5381,7 @@ void RasterizerStorageGLES3::update_particles() {
shaders.particles.bind(); shaders.particles.bind();
shaders.particles.set_uniform(ParticlesShaderGLES3::TOTAL_PARTICLES, particles->amount); shaders.particles.set_uniform(ParticlesShaderGLES3::TOTAL_PARTICLES, particles->amount);
shaders.particles.set_uniform(ParticlesShaderGLES3::TIME, Color(frame.time[0], frame.time[1], frame.time[2], frame.time[3])); shaders.particles.set_uniform(ParticlesShaderGLES3::TIME, frame.time[0]);
shaders.particles.set_uniform(ParticlesShaderGLES3::EXPLOSIVENESS, particles->explosiveness); shaders.particles.set_uniform(ParticlesShaderGLES3::EXPLOSIVENESS, particles->explosiveness);
shaders.particles.set_uniform(ParticlesShaderGLES3::LIFETIME, particles->lifetime); shaders.particles.set_uniform(ParticlesShaderGLES3::LIFETIME, particles->lifetime);
shaders.particles.set_uniform(ParticlesShaderGLES3::ATTRACTOR_COUNT, 0); shaders.particles.set_uniform(ParticlesShaderGLES3::ATTRACTOR_COUNT, 0);
@ -5447,8 +5447,6 @@ void RasterizerStorageGLES3::update_particles() {
} }
glDisable(GL_RASTERIZER_DISCARD); glDisable(GL_RASTERIZER_DISCARD);
} }
//////// ////////

View File

@ -20,7 +20,7 @@ layout(location=4) in highp vec2 uv_attrib;
layout(std140) uniform CanvasItemData { //ubo:0 layout(std140) uniform CanvasItemData { //ubo:0
highp mat4 projection_matrix; highp mat4 projection_matrix;
highp vec4 time; highp float time;
}; };
uniform highp mat4 modelview_matrix; uniform highp mat4 modelview_matrix;
@ -158,7 +158,7 @@ uniform sampler2D screen_texture; // texunit:-3
layout(std140) uniform CanvasItemData { layout(std140) uniform CanvasItemData {
highp mat4 projection_matrix; highp mat4 projection_matrix;
highp vec4 time; highp float time;
}; };

View File

@ -28,7 +28,7 @@ uniform float prev_system_phase;
uniform int total_particles; uniform int total_particles;
uniform float explosiveness; uniform float explosiveness;
uniform float randomness; uniform float randomness;
uniform vec4 time; uniform float time;
uniform float delta; uniform float delta;
uniform int attractor_count; uniform int attractor_count;

View File

@ -63,7 +63,6 @@ layout(std140) uniform SceneData { //ubo:0
highp mat4 projection_matrix; highp mat4 projection_matrix;
highp mat4 camera_inverse_matrix; highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix; highp mat4 camera_matrix;
highp vec4 time;
highp vec4 ambient_light_color; highp vec4 ambient_light_color;
highp vec4 bg_color; highp vec4 bg_color;
@ -83,6 +82,7 @@ layout(std140) uniform SceneData { //ubo:0
vec2 shadow_atlas_pixel_size; vec2 shadow_atlas_pixel_size;
vec2 directional_shadow_pixel_size; vec2 directional_shadow_pixel_size;
float time;
float z_far; float z_far;
float reflection_multiplier; float reflection_multiplier;
float subsurface_scatter_width; float subsurface_scatter_width;
@ -435,7 +435,6 @@ layout(std140) uniform SceneData {
highp mat4 projection_matrix; highp mat4 projection_matrix;
highp mat4 camera_inverse_matrix; highp mat4 camera_inverse_matrix;
highp mat4 camera_matrix; highp mat4 camera_matrix;
highp vec4 time;
highp vec4 ambient_light_color; highp vec4 ambient_light_color;
highp vec4 bg_color; highp vec4 bg_color;
@ -455,6 +454,7 @@ layout(std140) uniform SceneData {
vec2 shadow_atlas_pixel_size; vec2 shadow_atlas_pixel_size;
vec2 directional_shadow_pixel_size; vec2 directional_shadow_pixel_size;
float time;
float z_far; float z_far;
float reflection_multiplier; float reflection_multiplier;
float subsurface_scatter_width; float subsurface_scatter_width;

View File

@ -206,7 +206,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["RESTART"] = ShaderLanguage::TYPE_BOOL; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["RESTART"] = ShaderLanguage::TYPE_BOOL;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["CUSTOM"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["CUSTOM"] = ShaderLanguage::TYPE_VEC4;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TRANSFORM"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TRANSFORM"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["LIFETIME"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["LIFETIME"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["DELTA"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["DELTA"] = ShaderLanguage::TYPE_FLOAT;
shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["NUMBER"] = ShaderLanguage::TYPE_UINT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["NUMBER"] = ShaderLanguage::TYPE_UINT;