… | |
… | |
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 |
|
|
99 | z (vout.position) = |
97 | z (vout.position) = (ifelse ( |
100 | ifelse ( |
98 | lz < 0, |
101 | z < 0, |
99 | lz, |
102 | -1, |
|
|
103 | log2 (lz) * (2 / log2 (1e10)) - 1 |
100 | log (lz) * (2 / log (1e10)) |
104 | ) * w (vout.position); |
101 | ) - 1) * w (vout.position); |
105 | #endif |
|
|
106 | } |
102 | } |
107 | |
103 | |
108 | vsh_src = shader::shader_builder::stop (); |
104 | vsh_src = shader::shader_builder::stop (); |
109 | |
105 | |
110 | shader::shader_builder::start (); |
106 | shader::shader_builder::start (); |