Ignore:
Timestamp:
Jan 18, 2013, 12:16:52 AM (8 years ago)
Author:
lolbot
Message:

fixed 27 files out of 2315:

  • removed 0 CR characters
  • removed 188 trailing whitespaces
  • replaced 537 tabs with spaces
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/easymesh/shiny.lolfx

    r2227 r2232  
    7777    vec3 r = vec3(0.0, 0.0, 0.0);
    7878    float sdotn = 0.0;
    79         float light_radius_mod = 0.0;
     79    float light_radius_mod = 0.0;
    8080
    8181    //Light calculation for directional light
     
    8989        specular += specular_color * specular_reflect
    9090                 * pow(max(dot(r, v), 0.0), specular_power);
    91         //----------
    92    
     91    //----------
     92
    9393    //Light calculation for point light
    94         vec3 tmpLightDir = (in_View * in_Light2_Pos).xyz - pass_Vertex.xyz;
    95         light_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius));
     94    vec3 tmpLightDir = (in_View * in_Light2_Pos).xyz - pass_Vertex.xyz;
     95    light_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius));
    9696    s = normalize(tmpLightDir);
    9797    v = normalize(-pass_Vertex.xyz);
     
    103103        specular += specular_color * min(specular_reflect, light_radius_mod)
    104104                 * pow(max(dot(r, v), 0.0), specular_power);
    105         //----------
    106    
     105    //----------
     106
    107107    //Light calculation for cube light
    108         vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz;
    109         vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner);
    110         vec3 new_LightDir = Local_Vertex - Proj_Vertex;
    111 
    112         vec3 light_radius = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(new_LightDir / in_Light3_Size_Outer));
    113         light_radius_mod = min(light_radius.x, min(light_radius.y, light_radius.z));
    114 
    115         if (length(new_LightDir) == 0.0)
    116                 sdotn = 1.0;
    117         else
    118         {
    119                 new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz);
    120                 sdotn = max(dot(new_LightDir, pass_TNormal), 0.0);
    121             r = reflect(-new_LightDir, pass_TNormal);
    122                 if (sdotn > 0.0 && light_radius_mod > 0.0)
    123                         specular += specular_color * min(specular_reflect, light_radius_mod)
    124                                         * pow(max(dot(r, v), 0.0), specular_power);
    125         }
     108    vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz;
     109    vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner);
     110    vec3 new_LightDir = Local_Vertex - Proj_Vertex;
     111
     112    vec3 light_radius = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(new_LightDir / in_Light3_Size_Outer));
     113    light_radius_mod = min(light_radius.x, min(light_radius.y, light_radius.z));
     114
     115    if (length(new_LightDir) == 0.0)
     116        sdotn = 1.0;
     117    else
     118    {
     119        new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz);
     120        sdotn = max(dot(new_LightDir, pass_TNormal), 0.0);
     121        r = reflect(-new_LightDir, pass_TNormal);
     122        if (sdotn > 0.0 && light_radius_mod > 0.0)
     123            specular += specular_color * min(specular_reflect, light_radius_mod)
     124                    * pow(max(dot(r, v), 0.0), specular_power);
     125    }
    126126    diffuse += in_Light3_diffuse * min(sdotn, light_radius_mod);
    127         //----------
     127    //----------
    128128
    129129    vec3 light = ambient + diffuse + specular;
Note: See TracChangeset for help on using the changeset viewer.