diff --git a/graph.cpp b/graph.cpp index 00664865..dfbd744e 100644 --- a/graph.cpp +++ b/graph.cpp @@ -7405,7 +7405,7 @@ EX void drawthemap() { use_raycasting = false; if(WDIM == 3 && hyperbolic && pmodel == mdPerspective && !binarytiling) use_raycasting = true; - if(WDIM == 3 && sol && pmodel == mdGeodesic) + if(WDIM == 3 && (sol || nil) && pmodel == mdGeodesic) use_raycasting = true; if(WDIM == 3 && euclid && pmodel == mdPerspective && !binarytiling) use_raycasting = true; diff --git a/polygons.cpp b/polygons.cpp index bf65750a..6e4e9652 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -707,6 +707,11 @@ void geometry_information::compute_cornerbonus() { } // Make a wall +hyperpoint ray_kleinize(hyperpoint h, int id) { + if(geometry == gNil && among(id, 2, 5)) h[2] = 0; + return kleinize(h); + } + void geometry_information::make_wall(int id, vector vertices, vector weights) { wallstart.push_back(isize(raywall)); @@ -751,15 +756,23 @@ void geometry_information::make_wall(int id, vector vertices, vector ld center_altitude = 0; if(prod) for(int i=0; i 0. && pos[axis] > value) return 0.;\n" - " if(value < 0. && pos[axis] < value) return 0.;\n" - " if(tan[axis] == 0.) return .5;\n" - " float approx = (value - pos[axis]) / tan[axis];\n" - " for(int it=0; it<3; it++) {\n" - " if(approx <= 0. || approx > .5) return .5;\n" - " vec4 npos = get_pos(pos, tan * approx);\n" - " approx = approx * (value - pos[axis]) / (npos[axis] - pos[axis]);\n" - " }\n" - " if(approx < .001) approx = .001;\n" - " return approx;\n" - " }\n"; - - fmain += - " float d;\n" - " d = hp_distance(position, tangent, 0, uBinaryWidth);\n" - " if(d < dist) { dist = d; which = 0; }\n" - " d = hp_distance(position, tangent, 0, -uBinaryWidth);\n" - " if(d < dist) { dist = d; which = 4; }\n" - " d = hp_distance(position, tangent, 1, uBinaryWidth);\n" - " if(d < dist) { dist = d; which = 1; }\n" - " d = hp_distance(position, tangent, 1, -uBinaryWidth);\n" - " if(d < dist) { dist = d; which = 5; }\n" - " d = hp_distance(position, tangent, 2, log(2.)/2.);\n" - " if(d < dist) { dist = d; which = 2; }\n" - " d = hp_distance(position, tangent, 2, -log(2.)/2.);\n" - " if(d < dist) { dist = d; which = 6; }\n"; - } - - else { + if(!nonisotropic) { fmain += " if(which == -1) for(int i=0; i abs(nposition.y) ? -nposition.x*nposition.y : 0.) + nposition.z;\n"; + + fmain += + "if(next >= minstep) {\n"; + + if(sol) fmain += + "if(abs(nposition.x) > uBinaryWidth || abs(nposition.y) > uBinaryWidth || abs(nposition.z) > log(2.)/2.) {\n"; + else fmain += + "if(abs(nposition.x) > .5 || abs(nposition.y) > .5 || abs(rz) > .5) {\n"; + + fmain += + "next = dist / 2.; continue;\n" + "}\n" + "if(next < maxstep) next = next / 2.;\n" + "}\n" + "else {\n"; + + if(sol) fmain += + "if(nposition.x > uBinaryWidth) which = 0;\n" + "if(nposition.x <-uBinaryWidth) which = 4;\n" + "if(nposition.y > uBinaryWidth) which = 1;\n" + "if(nposition.y <-uBinaryWidth) which = 5;\n" + "if(nposition.z > log(2.)/2.) which = nposition.x > 0. ? 3 : 2;\n" + "if(nposition.z <-log(2.)/2.) which = nposition.y > 0. ? 7 : 6;\n"; + else fmain += + "if(nposition.x > .5) which = 3;\n" + "if(nposition.x <-.5) which = 0;\n" + "if(nposition.y > .5) which = 4;\n" + "if(nposition.y <-.5) which = 1;\n" + "if(rz > .5) which = 5;\n" + "if(rz <-.5) which = 2;\n"; + + fmain += + "next = maxstep;\n" + "}\n"; + + fmain += + "position = nposition;\n" "tangent = tangent + acc * dist;\n"; } else fmain += "position = position + tangent * dist;\n"; + fmain += " go = go + dist;\n"; + fmain += "if(which == -1) continue;\n"; - if(sol) { - fmain += - "if(which == 2 && position.x > 0.) which = 3;\n" - "if(which == 6 && position.y > 0.) which = 7;\n"; - } - // apply wall color fmain += " float u = cid + float(which) / float(uLength);\n" " vec4 col = texture1D(tWallcolor, u);\n" " if(col[3] > 0.0) {\n" " vec2 inface = map_texture(position, which);\n" - " float bright = min(1., 10. * (1.-inface.x-inface.y));\n" // texture2D(tWallTexture, (inface.yz + vec2(1.,1.))/2.).r;\n" + " float bright = min(1., 10. * (1.-inface.x-inface.y));\n"; // texture2D(tWallTexture, (inface.yz + vec2(1.,1.))/2.).r;\n" + + if(nil) fmain += + " if(abs(abs(position.x)-abs(position.y)) < .005) bright /= 2.;\n"; + + fmain += +// " float bright = min(1., 10. * (1.-inface.x-inface.y));\n" // texture2D(tWallTexture, (inface.yz + vec2(1.,1.))/2.).r;\n" // " col.xyz = col.xyz * bright * max(1.-go/7., 0.5 * exp(-go/4.));\n" // exp(-go/4.);\n" - " col.xyz = col.xyz * bright * exp(- go / 20.);\n" + " col.xyz = col.xyz * bright * exp(- go / 4.);\n" // " col.xyz = col.xyz * bright * max(1.-go/7., 0.5 * exp(-go/4.));\n" // exp(-go/4.);\n" " col.w = 1.;\n" // " if(purp == 1) { col.rgb = (col.rgb + vec3(1., 0., 1.)) / 2; }\n" @@ -378,7 +391,8 @@ EX void do_raycast() { GLERR("uniform IPD"); vector ms; - if(euclid || sol) + if(sol || nil) ; + else if(euclid) for(int j=0; jrelative_matrix(cwt.at->master, cwt.at->cmove(j)->master)); else for(int j=0; j