Inside3D!
     

strange bug ?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Sun Jan 03, 2010 12:58 pm    Post subject: strange bug ? Reply with quote

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 Laughing

not sure what gives i took great care calling this function before any rendering was done any ideas ?
Back to top
View user's profile Send private message
metlslime



Joined: 05 Feb 2008
Posts: 177

PostPosted: Sun Jan 03, 2010 10:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Mon Jan 04, 2010 5:16 am    Post subject: Reply with quote

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 Sad

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group