rotational model of Nil, and change Nil rotation

This commit is contained in:
Zeno Rogue
2020-09-11 11:13:18 +02:00
parent 59a7d3e562
commit 18ab187547
6 changed files with 70 additions and 17 deletions
+12
View File
@@ -269,6 +269,12 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
if(dim3) shader_flags |= SF_ZFOG;
}
if(nil && pmodel == mdPerspective) {
vsh += "uniform mediump float uRotCos, uRotSin, uRotNil;\n";
coordinator +=
"t.z += (uRotCos * t.x + uRotSin * t.y) * (uRotCos * t.y - uRotSin * t.x) * uRotNil / 2. - t.x * t.y / 2.;\n";
}
if(!skip_t) {
vmain += "mediump vec4 t = uMV * aPosition;\n";
vmain += coordinator;
@@ -503,6 +509,12 @@ void display_data::set_projection(int ed, ld shift) {
if(ed) glhr::projection_multiply(glhr::translate(vid.ipd * ed/2, 0, 0));
}
if(selected->uRotNil != -1) {
glUniform1f(selected->uRotCos, models::ocos);
glUniform1f(selected->uRotSin, models::osin);
glUniform1f(selected->uRotNil, pconf.rotational_nil);
}
if(selected->uPP != -1) {
glhr::glmatrix pp = glhr::id;
if(get_shader_flags() & SF_USE_ALPHA)