1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-08 17:34:08 +00:00

raycasting::: ray_comparison_mode

This commit is contained in:
Zeno Rogue 2019-10-23 23:10:50 +02:00
parent 0905117869
commit 8337a83568
2 changed files with 19 additions and 3 deletions

View File

@ -6065,7 +6065,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
color_t dummy; color_t dummy;
int ofs = wall_offset(c); int ofs = wall_offset(c);
if(isWall3(c, wcol)) { if(isWall3(c, wcol)) {
if(!use_raycasting) { if(!no_wall_rendering) {
color_t wcol2 = wcol; color_t wcol2 = wcol;
#if CAP_TEXTURE #if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol); if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
@ -6118,7 +6118,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
} }
} } } }
else { else {
if(!use_raycasting) for(int a=0; a<c->type; a++) if(c->move(a)) { if(!no_wall_rendering) for(int a=0; a<c->type; a++) if(c->move(a)) {
color_t t = transcolor(c, c->move(a), wcol); color_t t = transcolor(c, c->move(a), wcol);
if(t) { if(t) {
t = t - get_darkval(c, a) * ((t & 0xF0F0F000) >> 4); t = t - get_darkval(c, a) * ((t & 0xF0F0F000) >> 4);
@ -7347,6 +7347,8 @@ EX void precise_mouseover() {
EX transmatrix Viewbase; EX transmatrix Viewbase;
EX bool use_raycasting; EX bool use_raycasting;
EX bool no_wall_rendering;
EX bool ray_comparison_mode;
EX void drawthemap() { EX void drawthemap() {
check_cgi(); check_cgi();
@ -7409,6 +7411,9 @@ EX void drawthemap() {
use_raycasting = true; use_raycasting = true;
if(WDIM == 3 && euclid && pmodel == mdPerspective && !binarytiling) if(WDIM == 3 && euclid && pmodel == mdPerspective && !binarytiling)
use_raycasting = true; use_raycasting = true;
no_wall_rendering = use_raycasting;
ray_comparison_mode = anyshiftclick;
if(ray_comparison_mode) no_wall_rendering = false;
iinf[itSavedPrincess].name = minf[moPrincess].name; iinf[itSavedPrincess].name = minf[moPrincess].name;
@ -7449,7 +7454,7 @@ EX void drawthemap() {
profile_start(1); profile_start(1);
make_actual_view(); make_actual_view();
currentmap->draw(); currentmap->draw();
if(use_raycasting) do_raycast(); if(use_raycasting && !ray_comparison_mode) do_raycast();
drawWormSegments(); drawWormSegments();
drawBlizzards(); drawBlizzards();
drawArrowTraps(); drawArrowTraps();
@ -7714,6 +7719,14 @@ EX void drawfullmap() {
#if CAP_QUEUE #if CAP_QUEUE
drawqueue(); drawqueue();
#endif #endif
if(use_raycasting && ray_comparison_mode) {
glDepthFunc(GL_LEQUAL);
glClearDepth(1.0f);
glClear(GL_DEPTH_BUFFER_BIT);
do_raycast();
}
profile_stop(2); profile_stop(2);
} }

View File

@ -404,6 +404,9 @@ void bind_array(vector<array<float, 4>>& v, GLint t, GLuint& tx, int id) {
EX void do_raycast() { EX void do_raycast() {
enable_raycaster(); enable_raycaster();
if(ray_comparison_mode)
glColorMask( GL_TRUE,GL_FALSE,GL_FALSE,GL_TRUE );
auto& o = our_raycaster; auto& o = our_raycaster;