Python1320

sourcefuuu

Aug 24th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. //Trying to get player to cast shadows from projected textures in first person except from flashlight.
  2. // Test map for sdk: https://dl.dropboxusercontent.com/u/1910689/projectedhack.bsp
  3.  
  4. //0:28 - Rama: sooo you want localplayer to cast a shadow from his own flashlight?
  5. //0:35 - Python1320: the other way around
  6. //0:35 - Python1320: everything but flashlight
  7.  
  8. // this lets the model draw in shadows regardless of anything
  9. int C_BasePlayer::DrawModel( int flags )
  10. {
  11.    
  12.     if ((flags & STUDIO_RENDER) && (flags & STUDIO_SHADOWDEPTHTEXTURE)) {
  13.         return BaseClass::DrawModel(flags);
  14.     }
  15.    
  16. // this I hoped would let us add a way to choose whether to draw local player in the projected texture or not
  17. void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
  18.  
  19. FlashlightState_t state;
  20. state.m_bAlwaysDrawLocalPlayer = true;
  21.  
  22.  
  23. // this is something I hoped would carry the flag to another structure that we can actually see in CShadowDepthView
  24. void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
  25. {
  26.     // flashlightState.m_bAlwaysDrawLocalPlayer is false here, WHYYY????
  27.     shadowView.m_bAlwaysDrawLocalPlayer = flashlightState.m_bAlwaysDrawLocalPlayer;
  28.  
  29.  
  30. // this is what actually does the depth drawing for shadows, let's inject player here
  31. // remove the if (m_bAlwaysDrawLocalPlayer) to test the awesomeness
  32. void CShadowDepthView::Draw()
  33. //AFTER DrawOpaqueRenderables( DEPTH_MODE_SHADOW ); ADD
  34. if (m_bAlwaysDrawLocalPlayer) {
  35.     C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
  36.     if (pPlayer) {
  37.         DrawOpaqueRenderable(pPlayer, false, DEPTH_MODE_SHADOW, 0);
  38.         //todo: wepoon right when I get at least player to work
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment