2
0

vissample.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WWPhys *
  23. * *
  24. * $Archive:: /Commando/Code/wwphys/vissample.h $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 7/10/00 5:07p $*
  29. * *
  30. * $Revision:: 7 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef VISSAMPLE_H
  39. #define VISSAMPLE_H
  40. #include "visenum.h"
  41. #include "matrix3d.h"
  42. // Forward declarations
  43. class ChunkSaveClass;
  44. class ChunkLoadClass;
  45. /*
  46. ** VisSampleClass
  47. ** This class encapsulates the calculations to set up a vis-sample and the results
  48. ** of that sample.
  49. */
  50. class VisSampleClass
  51. {
  52. public:
  53. VisSampleClass(void);
  54. VisSampleClass(const Matrix3D & inital_view,VisDirBitsType direction_bits);
  55. void Init_Error(void);
  56. bool Save(ChunkSaveClass &chunk_save) const;
  57. bool Load(ChunkLoadClass &chunk_load);
  58. bool Sample_Rejected(void) const;
  59. bool Sample_Useless(void) const;
  60. bool Direction_Enabled(VisDirType direction_index) const;
  61. Matrix3D Get_Camera_Transform(VisDirType direction_index) const;
  62. int Sample_Status(VisDirType direction_index) const;
  63. float Backface_Fraction(VisDirType direction_index) const;
  64. float Get_Biggest_Fraction(void) const;
  65. int Get_Biggest_Fraction_Index(void) const;
  66. int Get_Cur_Direction(void) const;
  67. const char * Get_Cur_Direction_Name(void) const;
  68. void Set_Cur_Direction(VisDirType direction_index);
  69. void Set_Results(VisStatusType status,float fraction);
  70. int Get_Bits_Changed(void) { return BitsChanged; }
  71. void Set_Bits_Changed(int count) { BitsChanged = count; }
  72. protected:
  73. Matrix3D ViewTransform; // intial view transform
  74. int DirectionBits; // which directions were enabled for this sample
  75. VisDirType CurDirection;
  76. VisStatusType Status[6]; // sample status for each direction
  77. float BackfaceFraction[6]; // fraction of pixels that were backfacing for each direction
  78. int BitsChanged; // number of bits that changed with this sample
  79. };
  80. #endif