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.54 by root, Sat Dec 11 00:17:28 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 z (vout.position) = (log2 (lz) * (2 / log2 (1e10)) - 1) * w (vout.position);
98#if 0 97#if 0
99 z (vout.position) = 98 lz = (log (max (lz, 0) + 1) / log (1e18)) - 1;
100 ifelse ( 99#else
101 z < 0, 100 lz = ifelse (lz <= 0,
102 -1, 101 0,
103 log2 (lz) * (2 / log2 (1e10)) - 1 102 log (lz + 1) / log (1e18)
104 ) * w (vout.position); 103 ) - 1;
105#endif 104#endif
105 z (vout.position) = lz * w (vout.position);
106 } 106 }
107 107
108 vsh_src = shader::shader_builder::stop (); 108 vsh_src = shader::shader_builder::stop ();
109 109
110 shader::shader_builder::start (); 110 shader::shader_builder::start ();
111 111
112 if (ctx.pass->l) 112 if (ctx.pass->l)
113 { 113 {
114 ctx.pass->l->fsh (); 114 ctx.pass->l->fsh ();
115
116 fsh (ctx); 115 fsh (ctx);
117 } 116 }
118 else 117 else
118 // many drivers need both vertex and fragment shader, 'caboom!' otherwise
119 shader::compile::fout.frag_color = shader::compile::float4 (1., 0., 1., 1.); 119 shader::compile::fout.frag_color = shader::compile::float4 (0., 0., 0., 0.);
120 120
121 fsh_src = shader::shader_builder::stop (); 121 fsh_src = shader::shader_builder::stop ();
122 122
123 shader::program_object po = shader::get_program (vsh_src, fsh_src); 123 shader::program_object po = shader::get_program (vsh_src, fsh_src);
124 matmap.insert (pass_data::matmap_t::value_type (this, po)); 124 matmap.insert (pass_data::matmap_t::value_type (this, po));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines