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.51 by root, Fri Nov 26 03:48:40 2004 UTC vs.
Revision 1.52 by root, Sat Nov 27 03:33:51 2004 UTC

92 92
93 temp_1f lz; 93 temp_1f lz;
94 94
95 // TODO: negative z is not calculated in an acceptable way, clipping does horrible things(?) 95 // TODO: negative z is not calculated in an acceptable way, clipping does horrible things(?)
96 lz = z (vout.position); 96 lz = z (vout.position);
97 z (vout.position) = clamp ( 97 lz = ifelse (lz <= 0,
98 ifelse (lz <= 0,
99 lz, 98 lz,
100 log (lz + 1) * (2 / log (1e10)) 99 log (lz + 1) / log (1e10 + 1)
101 ) - 1, 100 ) - 1;
102 -1.F, +1.F 101 z (vout.position) = lz * w (vout.position);
103 ) * w (vout.position);
104 } 102 }
105 103
106 vsh_src = shader::shader_builder::stop (); 104 vsh_src = shader::shader_builder::stop ();
107 105
108 shader::shader_builder::start (); 106 shader::shader_builder::start ();
109 107
110 if (ctx.pass->l) 108 if (ctx.pass->l)
111 { 109 {
112 ctx.pass->l->fsh (); 110 ctx.pass->l->fsh ();
113
114 fsh (ctx); 111 fsh (ctx);
115 } 112 }
116 else 113 else
114 // many drivers need both vertex and fragment shader, 'caboom!' otherwise
117 shader::compile::fout.frag_color = shader::compile::float4 (1., 0., 1., 1.); 115 shader::compile::fout.frag_color = shader::compile::float4 (0., 0., 0., 0.);
118 116
119 fsh_src = shader::shader_builder::stop (); 117 fsh_src = shader::shader_builder::stop ();
120 118
121 shader::program_object po = shader::get_program (vsh_src, fsh_src); 119 shader::program_object po = shader::get_program (vsh_src, fsh_src);
122 matmap.insert (pass_data::matmap_t::value_type (this, po)); 120 matmap.insert (pass_data::matmap_t::value_type (this, po));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines