PageRenderTime 37ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llmath/llv4vector3.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 80 lines | 33 code | 12 blank | 35 comment | 0 complexity | 8855e62e6f18d40b4c9b602af1da9725 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llviewerjointmesh.cpp
  3. * @brief LLV4* class header file - vector processor enabled math
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLV4VECTOR3_H
  27. #define LL_LLV4VECTOR3_H
  28. #include "llv4math.h"
  29. //-----------------------------------------------------------------------------
  30. //-----------------------------------------------------------------------------
  31. // LLV4Vector3
  32. //-----------------------------------------------------------------------------
  33. //-----------------------------------------------------------------------------
  34. LL_LLV4MATH_ALIGN_PREFIX
  35. class LLV4Vector3
  36. {
  37. public:
  38. union {
  39. F32 mV[LLV4_NUM_AXIS];
  40. V4F32 v;
  41. };
  42. enum {
  43. ALIGNMENT = 16
  44. };
  45. void setVec(F32 x, F32 y, F32 z);
  46. void setVec(F32 a);
  47. }
  48. LL_LLV4MATH_ALIGN_POSTFIX;
  49. //-----------------------------------------------------------------------------
  50. //-----------------------------------------------------------------------------
  51. // LLV4Vector3
  52. //-----------------------------------------------------------------------------
  53. //-----------------------------------------------------------------------------
  54. inline void LLV4Vector3::setVec(F32 x, F32 y, F32 z)
  55. {
  56. mV[VX] = x;
  57. mV[VY] = y;
  58. mV[VZ] = z;
  59. }
  60. inline void LLV4Vector3::setVec(F32 a)
  61. {
  62. #if LL_VECTORIZE
  63. v = _mm_set1_ps(a);
  64. #else
  65. setVec(a, a, a);
  66. #endif
  67. }
  68. #endif