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

Comparing libgender/material.C (file contents):
Revision 1.44 by root, Sat Nov 6 14:49:03 2004 UTC vs.
Revision 1.45 by root, Sun Nov 7 02:28:18 2004 UTC

69{ 69{
70} 70}
71 71
72void material::enable (view &ctx) 72void material::enable (view &ctx)
73{ 73{
74 static shader::compile::varying_1f Z;//D
75
76 pass::matmap_t &matmap = ctx.pass_data->matmap; 74 pass::matmap_t &matmap = ctx.pass_data->matmap;
77 75
78 pass::matmap_t::iterator i = matmap.find (this); 76 pass::matmap_t::iterator i = matmap.find (this);
79 77
80 if (i == matmap.end ()) 78 if (i == matmap.end ())
86 if (ctx.pass_data->l) 84 if (ctx.pass_data->l)
87 ctx.pass_data->l->vsh (); 85 ctx.pass_data->l->vsh ();
88 86
89 vsh (ctx); 87 vsh (ctx);
90 88
89 // compute logarithmic depth - see the frustum matrix in view.C
91 { 90 {
92 using namespace shader::compile; 91 using namespace shader::compile;
93 92
94 Z = pow (z (vout.position) / 2.F, 0.2); 93 z (vout.position) = (log2 (max (z (vout.position), 0)) * (2 / log2 (1e10)) - 1) * w (vout.position);
95 z (vout.position) = (Z * 2 - 1) * w (vout.position);
96 //z (vout.position) = z (vout.position) - 1;
97 } 94 }
98 95
99 vsh_src = shader::shader_builder::stop (); 96 vsh_src = shader::shader_builder::stop ();
100 97
101 shader::shader_builder::start (); 98 shader::shader_builder::start ();
123 120
124 po->enable (); 121 po->enable ();
125 } 122 }
126 else 123 else
127 i->second->enable (); 124 i->second->enable ();
125
126 if (ctx.pass_data->l)
127 ctx.pass_data->l->enable ();
128} 128}
129 129
130void material::disable (view &ctx) 130void material::disable (view &ctx)
131{ 131{
132} 132}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines