Clip Functions to check Specific Models

From The DarkMod Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Originally written by Ishtvan on http://forums.thedarkmod.com/topic/3480

Looking at the clip functions for something else, I noticed there are some set up to clip vs. specific models, and to trace against everything but the world. I seem to remember this coming up in the past, but I never knew about these functions until now. For example in the rope arrows, there's sometimes a problem jumping between two rope arrows on a wall, because the trace hits the wall instead of the rope. This could be useful to ignore the world in the test, although we'd have to put in another test if a rope was found to make sure the player can't climb ropes through walls.

Anyway, here's a list of functions in idClip. Posting them will be useful to me anyway, because I always forget and have to look them up in the source:

   // clip versus the rest of the world
   bool      Translation( trace_t &results, const idVec3 &start, const idVec3 &end,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );
   bool      Rotation( trace_t &results, const idVec3 &start, const idRotation &rotation,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );
   bool      Motion( trace_t &results, const idVec3 &start, const idVec3 &end, const idRotation &rotation,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );
   int       Contacts( contactInfo_t *contacts, const int maxContacts, const idVec3 &start, const idVec6 &dir, const float depth,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );
   int       Contents( const idVec3 &start,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );

   // special case translations versus the rest of the world
   bool      TracePoint( trace_t &results, const idVec3 &start, const idVec3 &end,
             int contentMask, const idEntity *passEntity );
   bool      TraceBounds( trace_t &results, const idVec3 &start, const idVec3 &end, const idBounds &bounds,
             int contentMask, const idEntity *passEntity );

   // clip versus a specific model
   void      TranslationModel( trace_t &results, const idVec3 &start, const idVec3 &end,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask,
             cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis );
   void      RotationModel( trace_t &results, const idVec3 &start, const idRotation &rotation,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask,
             cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis );
   int       ContactsModel( contactInfo_t *contacts, const int maxContacts, const idVec3 &start, const idVec6 &dir, const float depth,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask,
             cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis );
   int       ContentsModel( const idVec3 &start,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask,
             cmHandle_t model, const idVec3 &modelOrigin, const idMat3 &modelAxis );

   // clip versus all entities but not the world
   void      TranslationEntities( trace_t &results, const idVec3 &start, const idVec3 &end,
             const idClipModel *mdl, const idMat3 &trmAxis, int contentMask, const idEntity *passEntity );

   // get a contact feature
   bool      GetModelContactFeature( const contactInfo_t &contact, const idClipModel *clipModel, idFixedWinding &winding ) const;

   // get entities/clip models within or touching the given bounds
   int       EntitiesTouchingBounds( const idBounds &bounds, int contentMask, idEntity **entityList, int maxCount ) const;
   int       ClipModelsTouchingBounds( const idBounds &bounds, int contentMask, idClipModel **clipModelList, int maxCount ) const;

   const idBounds & GetWorldBounds( void ) const;
   idClipModel *    DefaultClipModel( void );

   // stats and debug drawing
   void      PrintStatistics( void );
   void      DrawClipModels( const idVec3 &eye, const float radius, const idEntity *passEntity );
   bool      DrawModelContactFeature( const contactInfo_t &contact, const idClipModel *clipModel, int lifetime ) const;