… | |
… | |
144 | |
144 | |
145 | lc = (*ctx.pass_data->l)(); |
145 | lc = (*ctx.pass_data->l)(); |
146 | |
146 | |
147 | temp_3f rot1, rot2, rot3; |
147 | temp_3f rot1, rot2, rot3; |
148 | |
148 | |
149 | rot1 = yxz (texture_2d (normvar, texcoord) * 2.F - 1.F); |
149 | yxz (rot1) = (texture_2d (normvar, texcoord) * 2.F - 1.F); |
|
|
150 | |
|
|
151 | //rot1 = normal_matrix * rot1; |
|
|
152 | |
150 | rot2 = float3 (x(rot1), z(rot1), -y(rot1)); |
153 | rot2 = float3 (x(rot1), z(rot1), -y(rot1)); |
151 | rot3 = float3 (y(rot1), -x(rot1), z(rot1)); |
154 | rot3 = float3 (y(rot1), -x(rot1), z(rot1)); |
152 | |
155 | |
153 | normal = mat3 (rot1, rot2, rot3) * normal; |
156 | normal = mat3 (rot1, rot2, rot3) * normal; |
154 | |
157 | |
155 | fac = dot (normalize (normal), normalize (lightvec)); |
158 | fac = dot (normalize (normal), normalize (lightvec)); |
156 | fac = pow (max (fac, 0.0), 6); |
159 | fac = max (pow (max (fac, 0.0), 6), 0.3); |
157 | xyz (fout.frag_color) = (texture_2d (texvar, texcoord) + 0.2F) * lc * fac; |
160 | xyz (fout.frag_color) = (texture_2d (texvar, texcoord) + 0.2F) * lc * fac; |
|
|
161 | //xyz (fout.frag_color) = lc * fac; |
158 | } |
162 | } |
159 | } |
163 | } |
160 | |
164 | |
161 | void test_material::enable (view &ctx) |
165 | void test_material::enable (view &ctx) |
162 | { |
166 | { |