castres.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 : WWMath *
  23. * *
  24. * $Archive:: /Commando/Code/wwmath/castres.h $*
  25. * *
  26. * Author:: Greg_h *
  27. * *
  28. * $Modtime:: 11/14/00 2:59p $*
  29. * *
  30. * $Revision:: 10 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef CASTRES_H
  39. #define CASTRES_H
  40. #include "always.h"
  41. #include "vector3.h"
  42. #include "bittype.h"
  43. /**
  44. ** CastResultStruct
  45. ** Result of a volume or ray cast operation will be stored in the following structure
  46. ** NOTE: If you can avoid it, do not enable ComputeContactPoint. When casting rays, it is more
  47. ** efficient to use the resulting Fraction to compute the contact point outside of the
  48. ** collision detection code. In the case of AABox sweeping for character collision detection,
  49. ** you don't usually need the actual point of contact, etc etc.
  50. **
  51. ** The default state of ComputeContactPoint is *false*
  52. */
  53. struct CastResultStruct
  54. {
  55. CastResultStruct(void) { Reset(); }
  56. void Reset(void) { StartBad = false; Fraction = 1.0f; Normal.Set(0,0,0); SurfaceType = 0; ComputeContactPoint = false; ContactPoint.Set(0,0,0); }
  57. bool StartBad; // was the inital configuration interpenetrating something?
  58. float Fraction; // fraction of the move up until collision
  59. Vector3 Normal; // surface normal at the collision point
  60. uint32 SurfaceType; // surface type of polygon at collision point (see W3D_SURFACE_TYPES in w3d_file.h)
  61. bool ComputeContactPoint; // This signals the collision code to compute the point of collision
  62. Vector3 ContactPoint; // This will be set to the point of collision if ComputeContactPoint is true
  63. };
  64. #endif