mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 12:19:18 +00:00
3D:: shader variants for R3 and S3
This commit is contained in:
parent
4b356d9945
commit
1fcf58e17a
@ -218,8 +218,12 @@ void display_data::set_projection(int ed, bool apply_models) {
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::band;
|
||||
if(pmodel == mdHalfplane && hyperbolic && apply_models)
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::halfplane;
|
||||
if(DIM == 3)
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standard3;
|
||||
if(DIM == 3 && hyperbolic)
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardH3;
|
||||
if(DIM == 3 && euclid)
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3;
|
||||
if(DIM == 3 && sphere)
|
||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardS3;
|
||||
}
|
||||
|
||||
start_projection(ed, shaderside_projection);
|
||||
@ -258,7 +262,7 @@ void display_data::set_projection(int ed, bool apply_models) {
|
||||
|
||||
current_display->scrdist_text = cd->ysize * sc / 2;
|
||||
|
||||
if(glhr::new_shader_projection == glhr::shader_projection::standard3) {
|
||||
if(glhr::new_shader_projection == glhr::shader_projection::standardH3) {
|
||||
glhr::fog_max(1/binary::btrange);
|
||||
}
|
||||
|
||||
|
2
hyper.h
2
hyper.h
@ -3801,7 +3801,7 @@ namespace glhr {
|
||||
const GLfloat* as_array() const { return a[0]; }
|
||||
};
|
||||
|
||||
enum class shader_projection { standard, band, halfplane, standard3, MAX };
|
||||
enum class shader_projection { standard, band, halfplane, standardH3, standardR3, standardS3, MAX };
|
||||
|
||||
extern shader_projection new_shader_projection;
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ bool do_draw(cell *c) {
|
||||
bool do_draw(cell *c, const transmatrix& T) {
|
||||
if(DIM == 3) {
|
||||
if(hyperbolic && T[DIM][DIM] > binary::btrange_cosh) return false;
|
||||
if(euclid && hypot_d(tC0(T), 3) > 10) return false;
|
||||
if(euclid && hypot_d(tC0(T), 3) > 7) return false;
|
||||
setdist(c, 7, c);
|
||||
return true;
|
||||
}
|
||||
|
14
shaders.cpp
14
shaders.cpp
@ -491,7 +491,11 @@ void init() {
|
||||
bool mps = j != 0;
|
||||
bool band = (sp == shader_projection::band);
|
||||
bool hp = (sp == shader_projection::halfplane);
|
||||
bool s3 = (sp == shader_projection::standard3);
|
||||
bool sh3 = (sp == shader_projection::standardH3);
|
||||
bool sr3 = (sp == shader_projection::standardR3);
|
||||
bool ss3 = (sp == shader_projection::standardS3);
|
||||
|
||||
bool s3 = (sh3 || sr3 || ss3);
|
||||
|
||||
programs[i][j] = new GLprogram(stringbuilder(
|
||||
|
||||
@ -555,10 +559,12 @@ void init() {
|
||||
hp, "t.x /= -rads; t.y /= -rads; t.z = 1.0; t[3] = 1.0;",
|
||||
|
||||
s3, "vec4 t = uMV * aPosition;",
|
||||
s3, "vColor.xyz = vColor.xyz * (1.0 - acosh(t[3]) / uFog);",
|
||||
s3, "t[3] = 1.0;",
|
||||
sh3, "vColor.xyz = vColor.xyz * (1.0 - acosh(t[3]) / uFog);",
|
||||
sr3, "vColor.xyz = vColor.xyz * (1.0 - sqrt(t[0]*t[0] + t[1]*t[1] + t[2]*t[2]) / 7.);",
|
||||
ss3, "vColor.xyz = vColor.xyz * (1.0 - acos(t[3]) / 1.6);",
|
||||
sh3 || sr3,"t[3] = 1.0;",
|
||||
|
||||
band || hp,"gl_Position = uP * t;",
|
||||
band || hp || s3,"gl_Position = uP * t;",
|
||||
1, "}"),
|
||||
|
||||
stringbuilder(
|
||||
|
Loading…
Reference in New Issue
Block a user