/opengles/src/Utils.cpp

http://ftk.googlecode.com/ · C++ · 70 lines · 26 code · 9 blank · 35 comment · 1 complexity · fc46cddae01e40b0585789ec535aef26 MD5 · raw file

  1. // ==========================================================================
  2. //
  3. // Utils.cpp Helper functions for 3D Rendering Library
  4. //
  5. // --------------------------------------------------------------------------
  6. //
  7. // 09-14-2004 Hans-Martin Will initial version
  8. //
  9. // --------------------------------------------------------------------------
  10. //
  11. // Copyright (c) 2004, Hans-Martin Will. All rights reserved.
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions are
  15. // met:
  16. //
  17. // * Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. // * Redistributions in binary form must reproduce the above copyright
  20. // notice, this list of conditions and the following disclaimer in the
  21. // documentation and/or other materials provided with the distribution.
  22. //
  23. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  28. // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. // THE POSSIBILITY OF SUCH DAMAGE.
  34. //
  35. // ==========================================================================
  36. #include "stdafx.h"
  37. #include "Utils.h"
  38. namespace EGL {
  39. void CopyVector(const Vec3D & vector, GLfixed *params) {
  40. params[0] = vector.x();
  41. params[1] = vector.y();
  42. params[2] = vector.z();
  43. }
  44. void CopyVector(const Vec4D & vector, GLfixed *params) {
  45. params[0] = vector.x();
  46. params[1] = vector.y();
  47. params[2] = vector.z();
  48. params[3] = vector.w();
  49. }
  50. void CopyMatrix(const Matrix4x4& matrix, GLfixed *params) {
  51. for (size_t index = 0; index < 16; ++index) {
  52. params[index] = matrix.Element(index);
  53. }
  54. }
  55. void CopyColor(const FractionalColor & color, GLfixed *params) {
  56. params[0] = color.r;
  57. params[1] = color.g;
  58. params[2] = color.b;
  59. params[3] = color.a;
  60. }
  61. }