Leaked source code of windows server 2003
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.

148 lines
3.7 KiB

  1. /***************************************************************************\
  2. *
  3. * File: Matrix.inl
  4. *
  5. * History:
  6. * 3/25/2000: JStall: Created
  7. *
  8. * Copyright (C) 2000 by Microsoft Corporation. All rights reserved.
  9. *
  10. \***************************************************************************/
  11. #if !defined(BASE__Matrix_inl__INCLUDED)
  12. #define BASE__Matrix_inl__INCLUDED
  13. #pragma once
  14. /***************************************************************************\
  15. *****************************************************************************
  16. *
  17. * class Vector3
  18. *
  19. *****************************************************************************
  20. \***************************************************************************/
  21. //------------------------------------------------------------------------------
  22. inline
  23. Vector3::Vector3()
  24. {
  25. }
  26. //------------------------------------------------------------------------------
  27. inline
  28. Vector3::Vector3(const Vector3 & src)
  29. {
  30. m_rgfl[0] = src.m_rgfl[0];
  31. m_rgfl[1] = src.m_rgfl[1];
  32. m_rgfl[2] = src.m_rgfl[2];
  33. }
  34. //------------------------------------------------------------------------------
  35. inline
  36. Vector3::Vector3(float fl0, float fl1, float fl2)
  37. {
  38. m_rgfl[0] = fl0;
  39. m_rgfl[1] = fl1;
  40. m_rgfl[2] = fl2;
  41. }
  42. //------------------------------------------------------------------------------
  43. inline float
  44. Vector3::operator[](int x) const
  45. {
  46. AssertMsg((x < 3) && (x >= 0), "Ensure valid index");
  47. return m_rgfl[x];
  48. }
  49. //------------------------------------------------------------------------------
  50. inline float
  51. Vector3::Get(int x) const
  52. {
  53. AssertMsg((x < 3) && (x >= 0), "Ensure valid index");
  54. return m_rgfl[x];
  55. }
  56. //------------------------------------------------------------------------------
  57. inline void
  58. Vector3::Set(int x, float fl)
  59. {
  60. AssertMsg((x < 3) && (x >= 0), "Ensure valid index");
  61. m_rgfl[x] = fl;
  62. }
  63. //------------------------------------------------------------------------------
  64. inline void
  65. Vector3::Set(float flA, float flB, float flC)
  66. {
  67. m_rgfl[0] = flA;
  68. m_rgfl[1] = flB;
  69. m_rgfl[2] = flC;
  70. }
  71. //------------------------------------------------------------------------------
  72. inline void
  73. Vector3::Empty()
  74. {
  75. m_rgfl[0] = 0.0f;
  76. m_rgfl[1] = 0.0f;
  77. m_rgfl[2] = 0.0f;
  78. }
  79. /***************************************************************************\
  80. *****************************************************************************
  81. *
  82. * class Matrix3
  83. *
  84. *****************************************************************************
  85. \***************************************************************************/
  86. //------------------------------------------------------------------------------
  87. Matrix3::Matrix3(bool fInit)
  88. {
  89. if (fInit) {
  90. m_rgv[0].Set(1.0f, 0.0f, 0.0f);
  91. m_rgv[1].Set(0.0f, 1.0f, 0.0f);
  92. m_rgv[2].Set(0.0f, 0.0f, 1.0f);
  93. m_fIdentity = TRUE;
  94. m_fOnlyTranslate = TRUE;
  95. }
  96. }
  97. //------------------------------------------------------------------------------
  98. inline const Vector3 &
  99. Matrix3::operator[](int y) const
  100. {
  101. AssertMsg((y < 3) && (y >= 0), "Ensure valid index");
  102. return m_rgv[y];
  103. }
  104. //------------------------------------------------------------------------------
  105. inline float
  106. Matrix3::Get(int y, int x) const
  107. {
  108. return m_rgv[y][x];
  109. }
  110. //------------------------------------------------------------------------------
  111. inline void
  112. Matrix3::Set(int y, int x, float fl)
  113. {
  114. m_rgv[y].Set(x, fl);
  115. m_fIdentity = FALSE;
  116. m_fOnlyTranslate = FALSE;
  117. }
  118. #endif // BASE__Matrix_inl__INCLUDED