fixed dynfov culling bug

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2177 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-06-28 12:17:17 +00:00
parent c033db4973
commit 7363a42bf2
5 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -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, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps);
+2 -2
View File
@@ -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
+3 -3
View File
@@ -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();
+2 -2
View File
@@ -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;
+3 -4
View File
@@ -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<hyfov;
render_ceil = -pitch<hyfov;
render_floor = pitch<0.5f*fovy;
render_ceil = -pitch<0.5f*fovy;
render_seg_new(vx, vy, vh, MAX_MIP, 0, 0, ssize>>MAX_MIP, ssize>>MAX_MIP);
mipstats(stats[0], stats[1], stats[2]);