diff --git a/source/src/main.cpp b/source/src/main.cpp index f5ab68ec..28d49520 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -654,7 +654,7 @@ int main(int argc, char **argv) checkmapsounds(); checkplayerloopsounds(); - computeraytable(camera1->o.x, camera1->o.y); + computeraytable(camera1->o.x, camera1->o.y, dynfov()); if(frames>3) { gl_drawframe(screen->w, screen->h, fpshighfps ? fps/highfps : 1.0f), fps); diff --git a/source/src/protos.h b/source/src/protos.h index 35da3894..363bd58c 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -356,11 +356,11 @@ extern void blockpaste(block &b); extern void freeblock(block *&b); // worldrender -extern void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float widef, int w, int h); +extern void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, float fovy, int w, int h); extern int lod_factor(); // worldocull -extern void computeraytable(float vx, float vy); +extern void computeraytable(float vx, float vy, float fov); extern int isoccluded(float vx, float vy, float cx, float cy, float csize); // main diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 7a62fb6e..51a4c698 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -508,7 +508,7 @@ void drawreflection(float hf, int w, int h, float changelod, bool refract) resetcubes(); render_world(camera1->o.x, camera1->o.y, refract ? camera1->o.z : hf, changelod, - (int)camera1->yaw, (refract ? 1 : -1)*(int)camera1->pitch, dynfov(), size, size); + (int)camera1->yaw, (refract ? 1 : -1)*(int)camera1->pitch, dynfov(), fovy, size, size); setupstrips(); @@ -656,7 +656,7 @@ void drawminimap(int w, int h) resetcubes(); render_world(camera1->o.x, camera1->o.y, camera1->o.z, 1.0f, - (int)camera1->yaw, (int)camera1->pitch, 90.0f, size, size); + (int)camera1->yaw, (int)camera1->pitch, 90.0f, 90.0f, size, size); setupstrips(); @@ -848,7 +848,7 @@ void gl_drawframe(int w, int h, float changelod, float curfps) resetcubes(); render_world(camera1->o.x, camera1->o.y, camera1->o.z, changelod, - (int)camera1->yaw, (int)camera1->pitch, dynfov(), w, h); + (int)camera1->yaw, (int)camera1->pitch, dynfov(), fovy, w, h); setupstrips(); diff --git a/source/src/worldocull.cpp b/source/src/worldocull.cpp index 27e35fb9..f30669f2 100644 --- a/source/src/worldocull.cpp +++ b/source/src/worldocull.cpp @@ -16,14 +16,14 @@ COMMAND(toggleocull, ARG_NONE); // constructs occlusion map: cast rays in all directions on the 2d plane and record distance. // done exactly once per frame. -void computeraytable(float vx, float vy) +void computeraytable(float vx, float vy, float fov) { if(!ocull) return; odist = getvar("fog")*1.5f; float apitch = (float)fabs(camera1->pitch); - float af = getvar("fov")/2+apitch/1.5f+3; + float af = fov/2+apitch/1.5f+3; float byaw = (camera1->yaw-90+af)/360*PI2; float syaw = (camera1->yaw-90-af)/360*PI2; diff --git a/source/src/worldrender.cpp b/source/src/worldrender.cpp index abef70b2..fbc314ab 100644 --- a/source/src/worldrender.cpp +++ b/source/src/worldrender.cpp @@ -252,7 +252,7 @@ void distlod(int &low, int &high, int angle, float widef) // does some out of date view frustrum optimisation that doesn't contribute much anymore -void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, int w, int h) +void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, float fovy, int w, int h) { loopi(LARGEST_FACTOR) stats[i] = 0; min_lod = minimap ? MAX_LOD : MIN_LOD+abs(pitch)/12; @@ -288,9 +288,8 @@ void render_world(float vx, float vy, float vh, float changelod, int yaw, int pi lodtop = lod; distlod(lodright, lodleft, yaw<=45 ? yaw+45 : yaw-315, widef); } - float hyfov = fov*h/w/2; - render_floor = pitch>MAX_MIP, ssize>>MAX_MIP); mipstats(stats[0], stats[1], stats[2]);