… | |
… | |
89 | { |
89 | { |
90 | using namespace shader::compile; |
90 | using namespace shader::compile; |
91 | |
91 | |
92 | temp_1f lz; |
92 | temp_1f lz; |
93 | |
93 | |
94 | // TODO: negative z is not calculated in an acceptable way, clipping does horrible things(?) |
94 | // TODO: negative z is not calculated in an a very acceptable way |
95 | lz = z (vout.position); |
95 | lz = z (vout.position); |
96 | #if 0 |
96 | lz = sign (lz) * (log (abs (lz) + exp (1e0)) - 1e0) / log (1e30); |
97 | lz = (log (max (lz, 0) + 1) / log (1e30)) - 1; |
|
|
98 | #else |
|
|
99 | lz = ifelse (lz <= 0, |
|
|
100 | 0, |
|
|
101 | log (lz + 1) / log (1e30) |
|
|
102 | ) - 1; |
|
|
103 | #endif |
|
|
104 | z (vout.position) = lz * w (vout.position); |
97 | z (vout.position) = lz * w (vout.position); |
105 | } |
98 | } |
106 | |
99 | |
107 | vsh_src = shader::shader_builder::stop (); |
100 | vsh_src = shader::shader_builder::stop (); |
108 | |
101 | |