Changeset 6385d0f in opengl-game


Ignore:
Timestamp:
Apr 17, 2020, 3:09:05 AM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
4994692
Parents:
a52ba87
Message:

Change all shaders to have 3-space indentation

Location:
shaders
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • shaders/asteroid.frag

    ra52ba87 r6385d0f  
    2222
    2323void main() {
    24   // ambient intensity
    25   vec3 Ia = La * Ka;
     24   // ambient intensity
     25   vec3 Ia = La * Ka;
    2626
    27   // ambient intensity
    28   vec3 Ia2 = La * Ka;
     27   // ambient intensity
     28   vec3 Ia2 = La * Ka;
    2929
    30   vec3 direction_to_light_eye = normalize(light_position_eye - position_eye);
    31   float dot_prod = max(dot(direction_to_light_eye, normal_eye), 0.0);
     30   vec3 direction_to_light_eye = normalize(light_position_eye - position_eye);
     31   float dot_prod = max(dot(direction_to_light_eye, normal_eye), 0.0);
    3232
    33   // diffuse intensity
    34   vec3 Id = Ld * color * dot_prod;
     33   // diffuse intensity
     34   vec3 Id = Ld * color * dot_prod;
    3535
    36   vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
    37   float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
     36   vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
     37   float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
    3838
    39   // diffuse intensity
    40   vec3 Id2 = Ld * color * dot_prod2;
     39   // diffuse intensity
     40   vec3 Id2 = Ld * color * dot_prod2;
    4141
    42   vec3 surface_to_viewer_eye = normalize(-position_eye);
     42   vec3 surface_to_viewer_eye = normalize(-position_eye);
    4343
    44   vec3 reflection_eye = reflect(-direction_to_light_eye, normal_eye);
    45   float dot_prod_specular = max(dot(reflection_eye, surface_to_viewer_eye), 0.0);
    46   float specular_factor = pow(dot_prod_specular, specular_exponent);
     44   vec3 reflection_eye = reflect(-direction_to_light_eye, normal_eye);
     45   float dot_prod_specular = max(dot(reflection_eye, surface_to_viewer_eye), 0.0);
     46   float specular_factor = pow(dot_prod_specular, specular_exponent);
    4747
    48   vec3 reflection_eye2 = reflect(-direction_to_light2_eye, normal_eye);
    49   float dot_prod_specular2 = max(dot(reflection_eye2, surface_to_viewer_eye), 0.0);
    50   float specular_factor2 = pow(dot_prod_specular2, specular_exponent);
     48   vec3 reflection_eye2 = reflect(-direction_to_light2_eye, normal_eye);
     49   float dot_prod_specular2 = max(dot(reflection_eye2, surface_to_viewer_eye), 0.0);
     50   float specular_factor2 = pow(dot_prod_specular2, specular_exponent);
    5151
    52   // specular intensity
    53   vec3 Is = Ls * Ks * specular_factor;
    54   vec3 Is2 = Ls * Ks * specular_factor2;
     52   // specular intensity
     53   vec3 Is = Ls * Ks * specular_factor;
     54   vec3 Is2 = Ls * Ks * specular_factor2;
    5555
    56   frag_color = vec4((Is + Id + Ia + Is2 + Id2 + Ia2)/2, 1.0);
     56   frag_color = vec4((Is + Id + Ia + Is2 + Id2 + Ia2)/2, 1.0);
    5757}
  • shaders/asteroid.vert

    ra52ba87 r6385d0f  
    1414
    1515layout(binding = 1) readonly buffer StorageBufferObject {
    16     Object objects[];
     16   Object objects[];
    1717} sbo;
    1818
     
    3333
    3434void main() {
    35   position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0));
    36   normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
     35   position_eye = vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_position, 1.0));
     36   normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
    3737
    38   float hp_percent = sbo.objects[obj_index].hp / 10.0;
    39   vec3 damage_color = vec3(1.0, 0.0, 0.0);
    40   color = (vertex_color * hp_percent) + (damage_color * (1.0 - hp_percent));
     38   float hp_percent = sbo.objects[obj_index].hp / 10.0;
     39   vec3 damage_color = vec3(1.0, 0.0, 0.0);
     40   color = (vertex_color * hp_percent) + (damage_color * (1.0 - hp_percent));
    4141
    42   light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
    43   light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));
     42   light_position_eye = vec3(ubo.view * vec4(light_position_world, 1.0));
     43   light2_position_eye = vec3(ubo.view * vec4(light2_position_world, 1.0));
    4444
    45   if (sbo.objects[obj_index].deleted) {
    46      gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
    47   } else {
    48     gl_Position = ubo.proj * vec4(position_eye, 1.0);
    49   }
     45   if (sbo.objects[obj_index].deleted) {
     46      gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
     47   } else {
     48      gl_Position = ubo.proj * vec4(position_eye, 1.0);
     49   }
    5050}
  • shaders/scene.vert

    ra52ba87 r6385d0f  
    1212
    1313layout(binding = 1) readonly buffer StorageBufferObject {
    14     Object objects[];
     14   Object objects[];
    1515} sbo;
    1616
  • shaders/ship.frag

    ra52ba87 r6385d0f  
    3535   vec3 Id = Ld * Kd * dot_prod;
    3636
    37   vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
    38   float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
     37   vec3 direction_to_light2_eye = normalize(light2_position_eye - position_eye);
     38   float dot_prod2 = max(dot(direction_to_light2_eye, normal_eye), 0.0);
    3939
    40   // diffuse intensity
    41   vec3 Id2 = Ld * Kd * dot_prod2;
     40   // diffuse intensity
     41   vec3 Id2 = Ld * Kd * dot_prod2;
    4242
    4343   vec3 surface_to_viewer_eye = normalize(-position_eye);
  • shaders/ship.vert

    ra52ba87 r6385d0f  
    1212
    1313layout(binding = 1) readonly buffer StorageBufferObject {
    14     Object objects[];
     14   Object objects[];
    1515} sbo;
    1616
Note: See TracChangeset for help on using the changeset viewer.