View previous topic :: View next topic |
Author |
Message |
reckless
Joined: 24 Jan 2008 Posts: 390 Location: inside tha debugger
|
Posted: Sun Jan 03, 2010 12:58 pm Post subject: strange bug ? |
|
|
ive been working a bit on the culling in realm wanted to make a uniform system but i ran into some problems.
Code: | void R_VisCullEntities (void)
{
int i;
entity_t *ent;
if (!r_drawentities.value) return;
ent->occluded = false;
for (i = 0; i < cl_numvisedicts; i++)
{
// store current entity
ent = cl_visedicts[i];
// not an alias model (sprite checks are skipped)
if (ent->model->type != mod_alias) continue;
// get entity origin
VectorAdd (ent->origin, ent->model->mins, ent->mins);
VectorAdd (ent->origin, ent->model->maxs, ent->maxs);
// approximate the correct leaf for the entity in order to properly set fog and caustics.
// this isn't 100% accurate (no method ever could be unless we use water surfs as clipping
// planes) but it suffices pretty good for id1
ent->modelleaf = R_LeafForEntity (ent->mins, ent->maxs);
// adjust the bounding box if the model has been rotated
if (ent->angles[0] || ent->angles[1] || ent->angles[2])
{
// mark as occluded if the sphere is outside the frustum so that it wont have to be tested again
ent->occluded = R_CullSphere (ent->origin, ent->model->radius);
}
else
{
// mark as occluded if the box is outside the frustum so that it wont have to be tested again
ent->occluded = R_CullBox (ent->mins, ent->maxs);
}
}
} |
mh might notice where i pulled in these from. the problem im facing is that it pushes the viewent outside of the frustum in some odd angles the gun dissapears at other angles particle effects go boom
and to top it off sometimes the ground dissapears
not sure what gives i took great care calling this function before any rendering was done any ideas ? |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Sun Jan 03, 2010 10:34 pm Post subject: |
|
|
first of all,
Code: | ent->occluded = false; |
is being called before ent is even initialized. Did you mean to put this line inside the loop? |
|
Back to top |
|
 |
reckless
Joined: 24 Jan 2008 Posts: 390 Location: inside tha debugger
|
Posted: Mon Jan 04, 2010 5:16 am Post subject: |
|
|
added as an afterthought originally didnt have that cause the boolean value of the bounding box check can only be true/false.
and yes it actually made it worse so i removed it again.
its still not right though
maybe i should let someone have a look at the entire thing its pretty hard to post all the changes i made considering the numerous changes mh made before my messing around.
i did add in the sphere culling from tochris (might be that) ill try to disable it. the weird thing is in its original form it actually worked but was a mess. |
|
Back to top |
|
 |
|