1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 06:27:17 +00:00

accessors created for shader uniforms

This commit is contained in:
Zeno Rogue 2019-09-05 11:58:47 +02:00
parent 339f6820fe
commit caf838ed22
3 changed files with 20 additions and 8 deletions

View File

@ -363,20 +363,17 @@ void display_data::set_projection(int ed) {
} }
glUniform1i(glhr::current->tInvExpTable, glhr::INVERSE_EXP_BINDING);
glActiveTexture(GL_TEXTURE0 + glhr::INVERSE_EXP_BINDING); glActiveTexture(GL_TEXTURE0 + glhr::INVERSE_EXP_BINDING);
glBindTexture(GL_TEXTURE_3D, invexpid); glBindTexture(GL_TEXTURE_3D, invexpid);
glActiveTexture(GL_TEXTURE0 + 0); glActiveTexture(GL_TEXTURE0 + 0);
glUniform1f(glhr::current->uPRECX, solv::PRECX); glhr::set_solv_prec(solv::PRECX, solv::PRECY, solv::PRECZ);
glUniform1f(glhr::current->uPRECY, solv::PRECY);
glUniform1f(glhr::current->uPRECZ, solv::PRECZ);
} }
if(glhr::new_shader_projection == glhr::shader_projection::standardSL2) { if(glhr::new_shader_projection == glhr::shader_projection::standardSL2) {
glUniform1f(glhr::current->uIndexSL, 0); glhr::set_index_sl(0);
glUniform1i(glhr::current->uIterations, slr::steps); glhr::set_sl_iterations(slr::steps);
} }
auto cd = current_display; auto cd = current_display;

View File

@ -661,7 +661,7 @@ void dqi_poly::gldraw() {
if(min_slr < max_slr) { if(min_slr < max_slr) {
min_slr++; min_slr++;
glUniform1f(glhr::current->uIndexSL, M_PI * min_slr); glhr::set_index_sl(M_PI * min_slr);
goto next_slr; goto next_slr;
} }
} }
@ -1159,7 +1159,7 @@ void dqi_poly::draw() {
min_slr = ceil((-zr - z) / M_PI); min_slr = ceil((-zr - z) / M_PI);
max_slr = floor((zr - z) / M_PI); max_slr = floor((zr - z) / M_PI);
if(min_slr > max_slr) return; if(min_slr > max_slr) return;
glUniform1f(glhr::current->uIndexSL, M_PI * min_slr); glhr::set_index_sl(M_PI * min_slr);
} }
set_width(get_width(this)); set_width(get_width(this));
flags &= ~POLY_INVERSE; flags &= ~POLY_INVERSE;

View File

@ -381,6 +381,21 @@ struct GLprogram {
}; };
EX void set_index_sl(ld x) {
glUniform1f(glhr::current->uIndexSL, x);
}
EX void set_sl_iterations(int steps) {
glUniform1i(glhr::current->uIterations, steps);
}
EX void set_solv_prec(int x, int y, int z) {
glUniform1i(glhr::current->tInvExpTable, glhr::INVERSE_EXP_BINDING);
glUniform1f(glhr::current->uPRECX, x);
glUniform1f(glhr::current->uPRECY, y);
glUniform1f(glhr::current->uPRECZ, z);
}
GLprogram *programs[gmMAX][int(shader_projection::MAX)]; GLprogram *programs[gmMAX][int(shader_projection::MAX)];
string stringbuilder() { return ""; } string stringbuilder() { return ""; }