… | |
… | |
84 | if (ctx.pass_data->l) |
84 | if (ctx.pass_data->l) |
85 | ctx.pass_data->l->vsh (); |
85 | ctx.pass_data->l->vsh (); |
86 | |
86 | |
87 | vsh (ctx); |
87 | vsh (ctx); |
88 | |
88 | |
|
|
89 | // compute logarithmic depth - see the frustum matrix in view.C |
89 | { |
90 | { |
90 | using namespace shader::compile; |
91 | using namespace shader::compile; |
91 | |
92 | |
92 | z (vout.position) = (log2 (z (vout.position) + 1.F) * 1.82F - 1); |
93 | temp_1f lz; |
93 | //z (vout.position) = z (vout.position) - 1; |
94 | |
|
|
95 | // TODO: negative z is not calculated in an acceptable way |
|
|
96 | lz = z (vout.position); |
|
|
97 | z (vout.position) = (log2 (lz) * (2 / log2 (1e10)) - 1) * w (vout.position); |
94 | } |
98 | } |
95 | |
99 | |
96 | vsh_src = shader::shader_builder::stop (); |
100 | vsh_src = shader::shader_builder::stop (); |
97 | |
101 | |
98 | shader::shader_builder::start (); |
102 | shader::shader_builder::start (); |
… | |
… | |
113 | |
117 | |
114 | po->enable (); |
118 | po->enable (); |
115 | } |
119 | } |
116 | else |
120 | else |
117 | i->second->enable (); |
121 | i->second->enable (); |
|
|
122 | |
|
|
123 | if (ctx.pass_data->l) |
|
|
124 | ctx.pass_data->l->enable (); |
118 | } |
125 | } |
119 | |
126 | |
120 | void material::disable (view &ctx) |
127 | void material::disable (view &ctx) |
121 | { |
128 | { |
122 | } |
129 | } |