Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

  1. //========= Copyright � Valve Corporation, All rights reserved. ============//
  2. #include "cbase.h"
  3. #include "physics_softbody.h"
  4. CSoftbodyEnvironment g_SoftbodyEnvironment;
  5. static CSoftbodyProcess s_ClothSystemProcess;
  6. void CSoftbodyProcess::OnRestore()
  7. {
  8. // ToDo: implement softbody reset-all
  9. }
  10. //-----------------------------------------------------------------------------
  11. // Purpose:
  12. // Input :
  13. // Output :
  14. //-----------------------------------------------------------------------------
  15. void CSoftbodyProcess::Update( float frametime )
  16. {
  17. g_SoftbodyEnvironment.Step( frametime );
  18. }
  19. static RnDebugDrawOptions_t s_SoftbodyDebugDrawOptions( RN_SOFTBODY_DRAW_EDGES | RN_SOFTBODY_DRAW_POLYGONS );
  20. //-----------------------------------------------------------------------------
  21. // Purpose:
  22. // Input :
  23. // Output :
  24. //-----------------------------------------------------------------------------
  25. void CSoftbodyProcess::PostRender( )
  26. {
  27. #ifdef _DEBUG
  28. if ( softbody_debug.GetInt() <= 1 )
  29. {
  30. return;
  31. }
  32. if ( IMaterial *pDebugWireframeMaterial = materials->FindMaterial( "debug/softbodywire.vmt", TEXTURE_GROUP_OTHER, true ) )
  33. {
  34. CMatRenderContextPtr pRenderContext( materials );
  35. //IMaterial *pDebugSolidMaterial = materials->FindMaterial( "debug/clothsolid.vmt", TEXTURE_GROUP_OTHER, true );
  36. pRenderContext->Bind( pDebugWireframeMaterial );
  37. IMesh* pMatMesh = pRenderContext->GetDynamicMesh();
  38. for ( int i = 0; i < g_SoftbodyEnvironment.GetSoftbodyCount(); ++i )
  39. {
  40. g_SoftbodyEnvironment.GetSoftbody( i )->Draw( s_SoftbodyDebugDrawOptions, pMatMesh );
  41. }
  42. pMatMesh->Draw();
  43. }
  44. #endif
  45. }