vp.h 5.5 KB

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