ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libgender/material.C
(Generate patch)

Comparing cvsroot/libgender/material.C (file contents):
Revision 1.58 by root, Mon Feb 7 08:51:18 2005 UTC vs.
Revision 1.59 by root, Tue Feb 8 05:55:28 2005 UTC

140: tex ("textures/rockwall.jpg"), texvar (tex.name) 140: tex ("textures/rockwall.jpg"), texvar (tex.name)
141, norm ("textures/rockwall_normal.jpg"), normvar (norm.name) 141, norm ("textures/rockwall_normal.jpg"), normvar (norm.name)
142{ 142{
143} 143}
144 144
145
146void mat_timed::enable (view &ctx)
147{
148 material::enable (ctx);
149
150 time->set ((GLfloat) ((int)timer::now % 100));
151 sh_colour->set (vec3 (255, 0, 0) * (1.F / 255.F));
152}
153
154void mat_timed::disable (view &ctx)
155{
156 material::disable (ctx);
157}
158
159void mat_timed::vsh (view &ctx)
160{
161 using namespace shader::compile;
162 std_vsh ();
163
164 if (ctx.pass->l)
165 f_normal = normal_matrix * vin.normal;
166}
167
168void mat_timed::fsh (view &ctx)
169{
170 using namespace shader::compile;
171
172 if (ctx.pass->l)
173 {
174 temp_1f fac;
175
176 fac = dot (normalize (f_normal), normalize (ctx.pass->l->sh_lightvec));
177
178 //fac = (fac / 100) * (mod (time, 100)) ;
179 fac = time;
180
181 xyz (fout.frag_color) = float3 ((255/100) * fac, fac, fac);//ctx.pass->l->sh_colour * sh_colour * fac;
182 }
183}
184
145void mat_gouraud_shaded::enable (view &ctx) 185void mat_gouraud_shaded::enable (view &ctx)
146{ 186{
147 material::enable (ctx); 187 material::enable (ctx);
148 188
149 sh_colour->set (vec3 (c.r, c.g, c.b) * (1.F / 255.F)); 189 sh_colour->set (vec3 (c.r, c.g, c.b) * (1.F / 255.F));
235 material::disable (ctx); 275 material::disable (ctx);
236} 276}
237 277
238test_material *testmat; 278test_material *testmat;
239mat_gouraud_shaded *testmat2; 279mat_gouraud_shaded *testmat2;
280mat_timed *testmat3;
240 281

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines