… | |
… | |
106 | texcoord = xy (vin.tex_coord[0]); |
106 | texcoord = xy (vin.tex_coord[0]); |
107 | normal = normal_matrix * vin.normal; |
107 | normal = normal_matrix * vin.normal; |
108 | lightvec = xyz (lightpos - model_view_matrix * vin.vertex); |
108 | lightvec = xyz (lightpos - model_view_matrix * vin.vertex); |
109 | camdist = 1 - max (length (lightvec) / 10000., 0); |
109 | camdist = 1 - max (length (lightvec) / 10000., 0); |
110 | |
110 | |
111 | p.vsh->end (); |
|
|
112 | p.vsh->compile (); |
111 | p.vsh->stop (); |
113 | |
112 | |
114 | p.fsh->start (); |
113 | p.fsh->start (); |
115 | |
114 | |
116 | temp_1f fac; |
115 | temp_1f fac; |
117 | temp_2f disp; |
116 | temp_2f disp; |
… | |
… | |
123 | //fac = dot (shader::compile::vec3 (normalize (fin.tex_coord[1]) + normalize (fin.tex_coord[2])) * 0.5, bumpnormal); |
122 | //fac = dot (shader::compile::vec3 (normalize (fin.tex_coord[1]) + normalize (fin.tex_coord[2])) * 0.5, bumpnormal); |
124 | //fac = dot (bumpnormal, normalize (fin.tex_coord[2])); |
123 | //fac = dot (bumpnormal, normalize (fin.tex_coord[2])); |
125 | fac = pow (max (fac, 0.0), 2); |
124 | fac = pow (max (fac, 0.0), 2); |
126 | xyz (fout.frag_color) = texture_2d (texvar, texcoord) * (fac + 0.4) * camdist; |
125 | xyz (fout.frag_color) = texture_2d (texvar, texcoord) * (fac + 0.4) * camdist; |
127 | |
126 | |
128 | p.fsh->end (); |
|
|
129 | p.fsh->compile (); |
127 | p.fsh->stop (); |
130 | p.link (); |
128 | p.link (); |
131 | } |
129 | } |
132 | |
130 | |
133 | void test_material::enable (view &ctx) |
131 | void test_material::enable (view &ctx) |
134 | { |
132 | { |