Changeset 1589


Ignore:
Timestamp:
Jul 8, 2012, 12:25:49 AM (7 years ago)
Author:
sam
Message:

easymesh: the light direction is now a uniform variable.

File:
1 edited

Legend:

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

    r1510 r1589  
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     8
    89uniform mat4 in_ModelView;
    910uniform mat4 in_Proj;
    1011uniform mat3 in_NormalMat;
     12uniform vec3 in_LightDir = vec3(0.3, 0.3, 0.7);
    1113uniform float in_Damage;
     14
    1215varying vec4 pass_Color;
    1316
     
    2023    /* World properties */
    2124    float ambient_mul = 0.5;
    22     vec3 light_dir = normalize(vec3(0.3, 0.3, 0.7));
    2325    vec3 ambient_color = vec3(0.25, 0.2, 0.35);
    2426    vec3 diffuse_color = vec3(1.0, 1.0, 0.6);
     
    2830    vec4 eye = in_ModelView * vec4(in_Vertex, 1.0);
    2931
    30     vec3 s = light_dir; /* normalize(eye - lightpos); */
     32    vec3 s = in_LightDir; /* normalize(eye - lightpos); */
    3133    vec3 v = normalize(-eye.xyz);
    3234    vec3 r = reflect(-s, tnorm);
     
    6567          uniform float4x4 in_Proj,
    6668          uniform float3x3 in_NormalMat,
     69          uniform vec3 in_LightDir = normalize(float3(0.3, 0.3, 0.7))
    6770          uniform float in_Damage,
    6871          out float4 out_Position : POSITION,
     
    7275    float specular_power = 60.0;
    7376    float ambient_mul = 0.5;
    74     float3 light_dir = normalize(float3(0.3, 0.3, 0.7));
    7577    float3 ambient_color = float3(0.25, 0.2, 0.35);
    7678    float3 diffuse_color = float3(1.0, 1.0, 0.6);
     
    7880    float3 tnorm = normalize(mul(in_NormalMat, in_Normal));
    7981    float4 eye = mul(in_ModelView, float4(in_Vertex, 1.0));
    80     float3 s = light_dir;
     82    float3 s = in_LightDir;
    8183    float3 v = normalize(-eye.xyz);
    8284    float3 r = reflect(-s, tnorm);
Note: See TracChangeset for help on using the changeset viewer.