Advertisement
szymski

Untitled

Jan 30th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1.  
  2. /*
  3. After calling this func, you draw a mask
  4. */
  5. function matcore.StencilStart()
  6. render.ClearStencil()
  7. render.SetStencilEnable( true )
  8. render.SetStencilWriteMask( 1 )
  9. render.SetStencilTestMask( 1 )
  10. render.SetStencilFailOperation( STENCILOPERATION_KEEP )
  11. render.SetStencilZFailOperation( STENCILOPERATION_KEEP )
  12. render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
  13. render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_ALWAYS )
  14. render.SetStencilReferenceValue( 1 )
  15. render.SetColorModulation( 1, 1, 1 )
  16. end
  17.  
  18. /*
  19. When your mask is done, call this and draw something (like the model in CircularHUD)
  20. */
  21. function matcore.StencilReplace(v)
  22. render.SetStencilCompareFunction( STENCILCOMPARISONFUNCTION_EQUAL )
  23. render.SetStencilPassOperation( STENCILOPERATION_REPLACE )
  24. render.SetStencilReferenceValue(v or 1)
  25. end
  26.  
  27. /*
  28. After all, disable stencil buffer
  29. */
  30. function matcore.StencilEnd()
  31. render.SetStencilEnable( false )
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement