… | |
… | |
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); |
|
|
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 |
94 | } |
106 | } |
95 | |
107 | |
96 | vsh_src = shader::shader_builder::stop (); |
108 | vsh_src = shader::shader_builder::stop (); |
97 | |
109 | |
98 | shader::shader_builder::start (); |
110 | shader::shader_builder::start (); |
… | |
… | |
113 | |
125 | |
114 | po->enable (); |
126 | po->enable (); |
115 | } |
127 | } |
116 | else |
128 | else |
117 | i->second->enable (); |
129 | i->second->enable (); |
|
|
130 | |
|
|
131 | if (ctx.pass_data->l) |
|
|
132 | ctx.pass_data->l->enable (); |
118 | } |
133 | } |
119 | |
134 | |
120 | void material::disable (view &ctx) |
135 | void material::disable (view &ctx) |
121 | { |
136 | { |
122 | } |
137 | } |