Advertisement
psy_commando

bullet render method

May 22nd, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. void C_BulletManager::Render()
  2. {
  3.    if ( r_drawothermodels.GetInt() )
  4.    {
  5.       for( int i = 0; i < m_Bullets.Count(); ++i )
  6.       {
  7.          C_Bulletlet * bullet = &m_Bullets[i];
  8.          // Necessary for lighting blending
  9.            bullet->CreateModelInstance();
  10.  
  11.          if ( !bullet->GetModel() )
  12.               return;
  13.  
  14.          // Make sure hdr is valid for drawing
  15.          if ( !bullet->GetModelPtr() )
  16.             return;
  17.  
  18.  
  19.          CMatRenderContextPtr pRenderContext( materials );
  20.           ClientModelRenderInfo_t info;
  21.           ClientModelRenderInfo_t *pInfo;
  22.  
  23.           pInfo = &info;
  24.  
  25.           pInfo->flags = STUDIO_WIREFRAME | STUDIO_RENDER;
  26.           pInfo->pRenderable = (IClientRenderable*)bullet;
  27.           pInfo->instance = bullet->GetModelInstance();
  28.          pInfo->entity_index = bullet->GetOwner()->entindex();
  29.           pInfo->pModel = bullet->GetModel();
  30.           pInfo->origin = bullet->GetRenderOrigin();
  31.           pInfo->angles = vec3_angle;
  32.           pInfo->skin = 0;
  33.           pInfo->body = 0;
  34.          //pInfo->pModelToWorld = &bullet->GetOwner()->EntityToWorldTransform();
  35.           //pInfo->hitboxset = m_nHitboxSet;
  36.  
  37.            // Assert( !pInfo->pModelToWorld);
  38.            if ( !pInfo->pModelToWorld )
  39.            {
  40.                pInfo->pModelToWorld = &pInfo->modelToWorld;
  41.  
  42.                // Turns the origin + angles into a matrix
  43.                AngleMatrix( pInfo->angles, pInfo->origin, pInfo->modelToWorld );
  44.            }
  45.  
  46.          bool bMarkAsDrawn = false;
  47.            // Suppress unlocking
  48.            CMatRenderDataReference rd( pRenderContext );
  49.            DrawModelState_t state;
  50.            matrix3x4_t *pBoneToWorld;
  51.            bMarkAsDrawn = modelrender->DrawModelSetup( *pInfo, &state, &pBoneToWorld );
  52.  
  53.            modelrender->DrawModelExecute( state, *pInfo, pBoneToWorld );
  54.          return;
  55.       }
  56.       return;
  57.    }
  58.    return;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement