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.

76 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef RADIAL_H
  14. #define RADIAL_H
  15. #pragma once
  16. #include "mathlib/bumpvects.h"
  17. #include "mathlib/ssemath.h"
  18. #include "lightmap.h"
  19. #define RADIALDIST2 2 // (1.25*1.25+1.25*1.25)
  20. #define RADIALDIST 1.42 // 1.77 // sqrt( RADIALDIST2 )
  21. #define WEIGHT_EPS 0.00001f
  22. //-----------------------------------------------------------------------------
  23. // The radial_t data structure is used to accumulate irregularly spaced and irregularly
  24. // shaped direct and indirect lighting samples into a uniformly spaced and shaped luxel grid.
  25. //
  26. // The name "radial" is more historical than discriptive; it stems from the filtering method,
  27. // one of several methods initially tried. Since all the other methods have since been deleted,
  28. // it would probably be more accurate to rename it something like "LuxelAccumulationBucket" or
  29. // something similar, but since "radial" is fairly meaningless it's not like it's actually confusing
  30. // the issue.
  31. //-----------------------------------------------------------------------------
  32. typedef struct radial_s
  33. {
  34. int facenum;
  35. lightinfo_t l;
  36. int w, h;
  37. float weight[SINGLEMAP];
  38. LightingValue_t light[NUM_BUMP_VECTS + 1][SINGLEMAP];
  39. } radial_t;
  40. void WorldToLuxelSpace( lightinfo_t const *l, Vector const &world, Vector2D &coord );
  41. void LuxelSpaceToWorld( lightinfo_t const *l, float s, float t, Vector &world );
  42. void WorldToLuxelSpace( lightinfo_t const *l, FourVectors const &world, FourVectors &coord );
  43. void LuxelSpaceToWorld( lightinfo_t const *l, fltx4 s, fltx4 t, FourVectors &world );
  44. void AddDirectToRadial( radial_t *rad,
  45. Vector const &pnt,
  46. Vector2D const &coordmins, Vector2D const &coordmaxs,
  47. Vector const light[NUM_BUMP_VECTS+1],
  48. bool hasBumpmap, bool neighborHasBumpmap );
  49. void AddBounceToRadial( radial_t *rad,
  50. Vector const &pnt,
  51. Vector2D const &coordmins, Vector2D const &coordmaxs,
  52. Vector const light[NUM_BUMP_VECTS+1],
  53. bool hasBumpmap, bool neighborHasBumpmap );
  54. bool SampleRadial( radial_t *rad, Vector& pnt, Vector light[NUM_BUMP_VECTS+1], int bumpSampleCount );
  55. radial_t *AllocateRadial( int facenum );
  56. void FreeRadial( radial_t *rad );
  57. bool SampleRadial( radial_t *rad, Vector& pnt, Vector light[NUM_BUMP_VECTS + 1], int bumpSampleCount );
  58. radial_t *BuildPatchRadial( int facenum );
  59. // utilities
  60. bool FloatLess( float const& src1, float const& src2 );
  61. #endif