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.48 by root, Sun Nov 7 03:28:20 2004 UTC vs.
Revision 1.53 by root, Fri Dec 10 05:37:09 2004 UTC

90 { 90 {
91 using namespace shader::compile; 91 using namespace shader::compile;
92 92
93 temp_1f lz; 93 temp_1f lz;
94 94
95 // TODO: negative z is not calculated in an acceptable way 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 lz = ifelse (lz <= 0,
98 0,
99 log (lz + 1) / log (1e18)
100 ) - 1;
97 z (vout.position) = (log2 (lz) * (2 / log2 (1e10)) - 1) * w (vout.position); 101 z (vout.position) = lz * w (vout.position);
98#if 0
99 z (vout.position) =
100 ifelse (
101 z < 0,
102 -1,
103 log2 (lz) * (2 / log2 (1e10)) - 1
104 ) * w (vout.position);
105#endif
106 } 102 }
107 103
108 vsh_src = shader::shader_builder::stop (); 104 vsh_src = shader::shader_builder::stop ();
109 105
110 shader::shader_builder::start (); 106 shader::shader_builder::start ();
111 107
112 if (ctx.pass->l) 108 if (ctx.pass->l)
113 { 109 {
114 ctx.pass->l->fsh (); 110 ctx.pass->l->fsh ();
115
116 fsh (ctx); 111 fsh (ctx);
117 } 112 }
118 else 113 else
114 // many drivers need both vertex and fragment shader, 'caboom!' otherwise
119 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.);
120 116
121 fsh_src = shader::shader_builder::stop (); 117 fsh_src = shader::shader_builder::stop ();
122 118
123 shader::program_object po = shader::get_program (vsh_src, fsh_src); 119 shader::program_object po = shader::get_program (vsh_src, fsh_src);
124 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