Team Fortress 2 Source Code as on 22/4/2020
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.

50 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "bsplib.h"
  9. #include "vbsp.h"
  10. void SaveVertexNormals( void )
  11. {
  12. int i, j;
  13. dface_t *f;
  14. texinfo_t *tex;
  15. g_numvertnormalindices = 0;
  16. g_numvertnormals = 0;
  17. for( i = 0 ;i<numfaces ; i++ )
  18. {
  19. f = &dfaces[i];
  20. tex = &texinfo[f->texinfo];
  21. for( j = 0; j < f->numedges; j++ )
  22. {
  23. if( g_numvertnormalindices == MAX_MAP_VERTNORMALINDICES )
  24. {
  25. Error( "g_numvertnormalindices == MAX_MAP_VERTNORMALINDICES (%d)", MAX_MAP_VERTNORMALINDICES );
  26. }
  27. g_vertnormalindices[g_numvertnormalindices] = g_numvertnormals;
  28. g_numvertnormalindices++;
  29. }
  30. // Add this face plane's normal.
  31. // Note: this doesn't do an exhaustive vertex normal match because the vrad does it.
  32. // The result is that a little extra memory is wasted coming out of vbsp, but it
  33. // goes away after vrad.
  34. if( g_numvertnormals == MAX_MAP_VERTNORMALS )
  35. {
  36. Error( "g_numvertnormals == MAX_MAP_VERTNORMALS (%d)", MAX_MAP_VERTNORMALS );
  37. }
  38. g_vertnormals[g_numvertnormals] = dplanes[f->planenum].normal;
  39. g_numvertnormals++;
  40. }
  41. }