vp.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/vp.h $*
  25. * *
  26. * Author:: Hector Yee *
  27. * *
  28. * $Modtime:: 6/27/01 11:39a $*
  29. * *
  30. * $Revision:: 12 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * Transform - transforms a vector array given Matrix3D *
  35. * Copy - Copies data from source to destination *
  36. * CopyIndexed-copies dst[]=src[index[]] *
  37. * Clear - clears array to zero *
  38. * Normalize - normalize the array *
  39. * MinMax - Finds the min and max of the array *
  40. * *
  41. *----------------------------------------------------------------------------------------------*
  42. */
  43. #if defined(_MSC_VER)
  44. #pragma once
  45. #endif
  46. #ifndef VECTORPROCESSOR_H
  47. #define VECTORPROCESSOR_H
  48. class Vector2;
  49. class Vector3;
  50. class Vector4;
  51. class Matrix3D;
  52. class Matrix4;
  53. class VectorProcessorClass
  54. {
  55. public:
  56. static void Transform(Vector3* dst,const Vector3 *src, const Matrix3D& matrix, const int count);
  57. static void Transform(Vector4* dst,const Vector3 *src, const Matrix4& matrix, const int count);
  58. static void Copy(unsigned *dst,const unsigned *src, const int count);
  59. static void Copy(Vector2 *dst,const Vector2 *src, const int count);
  60. static void Copy(Vector3 *dst,const Vector3 *src, const int count);
  61. static void Copy(Vector4 *dst,const Vector4 *src, const int count);
  62. static void Copy(Vector4 *dst,const Vector3 *src, const float * srca, const int count);
  63. static void Copy(Vector4 *dst,const Vector3 *src, const float srca, const int count);
  64. static void Copy(Vector4 *dst,const Vector3 &src, const float * srca, const int count);
  65. static void CopyIndexed(unsigned *dst,const unsigned *src, const unsigned int *index, const int count);
  66. static void CopyIndexed(Vector2 *dst,const Vector2 *src, const unsigned int *index, const int count);
  67. static void CopyIndexed(Vector3 *dst,const Vector3 *src, const unsigned int *index, const int count);
  68. static void CopyIndexed(Vector4 *dst,const Vector4 *src, const unsigned int *index, const int count);
  69. static void CopyIndexed(unsigned char* dst, const unsigned char* src, const unsigned int *index, int count);
  70. static void CopyIndexed(float* dst, float* src, const unsigned int *index, int count);
  71. static void Clamp(Vector4 *dst,const Vector4 *src, const float min, const float max, const int count);
  72. static void Clear (Vector3 *dst, const int count);
  73. static void Normalize(Vector3 *dst, const int count);
  74. static void MinMax(Vector3 *src, Vector3 &min, Vector3 &max, const int count);
  75. static void MulAdd(float * dest,float multiplier,float add,int count);
  76. static void Prefetch(void* address);
  77. static void DotProduct(float *dst, const Vector3 &a, const Vector3 *b,const int count);
  78. static void ClampMin(float *dst, float *src, const float min, const int count);
  79. static void Power(float *dst, float *src, const float pow, const int count);
  80. };
  81. #endif // VECTORPROCESSOR_H