… | |
… | |
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); |
93 | z (vout.position) = (log2 (max (z (vout.position), 0)) * (2 / log2 (1e10)) - 1) * w (vout.position); |
93 | z (vout.position) = z (vout.position) - 1; |
|
|
94 | } |
94 | } |
95 | |
95 | |
96 | vsh_src = shader::shader_builder::stop (); |
96 | vsh_src = shader::shader_builder::stop (); |
97 | |
97 | |
98 | shader::shader_builder::start (); |
98 | shader::shader_builder::start (); |
… | |
… | |
104 | fsh (ctx); |
104 | fsh (ctx); |
105 | } |
105 | } |
106 | else |
106 | else |
107 | shader::compile::fout.frag_color = shader::compile::float4 (1., 0., 1., 1.); |
107 | shader::compile::fout.frag_color = shader::compile::float4 (1., 0., 1., 1.); |
108 | |
108 | |
|
|
109 | { |
|
|
110 | using namespace shader::compile; |
|
|
111 | //x (fout.frag_color) = Z;//D |
|
|
112 | //y (fout.frag_color) = Z;//D |
|
|
113 | //z (fout.frag_color) = Z;//D |
|
|
114 | } |
|
|
115 | |
109 | fsh_src = shader::shader_builder::stop (); |
116 | fsh_src = shader::shader_builder::stop (); |
110 | |
117 | |
111 | shader::program_object po = shader::get_program (vsh_src, fsh_src); |
118 | shader::program_object po = shader::get_program (vsh_src, fsh_src); |
112 | matmap.insert (pass::matmap_t::value_type (this, po)); |
119 | matmap.insert (pass::matmap_t::value_type (this, po)); |
113 | |
120 | |
114 | po->enable (); |
121 | po->enable (); |
115 | } |
122 | } |
116 | else |
123 | else |
117 | i->second->enable (); |
124 | i->second->enable (); |
|
|
125 | |
|
|
126 | if (ctx.pass_data->l) |
|
|
127 | ctx.pass_data->l->enable (); |
118 | } |
128 | } |
119 | |
129 | |
120 | void material::disable (view &ctx) |
130 | void material::disable (view &ctx) |
121 | { |
131 | { |
122 | } |
132 | } |