Clone of mesa.
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.

indirect_transpose_matrix.c 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* -*- mode: c; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3; coding: utf-8-unix -*- */
  2. /*
  3. * (C) Copyright IBM Corporation 2004
  4. * All Rights Reserved.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a
  7. * copy of this software and associated documentation files (the "Software"),
  8. * to deal in the Software without restriction, including without limitation
  9. * on the rights to use, copy, modify, merge, publish, distribute, sub
  10. * license, and/or sell copies of the Software, and to permit persons to whom
  11. * the Software is furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the next
  14. * paragraph) shall be included in all copies or substantial portions of the
  15. * Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  20. * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  21. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  22. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23. * USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. #include <GL/gl.h>
  26. #include "indirect.h"
  27. static void TransposeMatrixf(const GLfloat s[16], GLfloat d[16])
  28. {
  29. int i, j;
  30. for (i = 0; i < 4; i++) {
  31. for (j = 0; j < 4; j++) {
  32. d[i*4+j] = s[j*4+i];
  33. }
  34. }
  35. }
  36. static void TransposeMatrixd(const GLdouble s[16], GLdouble d[16])
  37. {
  38. int i, j;
  39. for (i = 0; i < 4; i++) {
  40. for (j = 0; j < 4; j++) {
  41. d[i*4+j] = s[j*4+i];
  42. }
  43. }
  44. }
  45. void
  46. __indirect_glLoadTransposeMatrixdARB( const GLdouble * m )
  47. {
  48. GLdouble mt[16];
  49. TransposeMatrixd( m, mt );
  50. __indirect_glLoadMatrixd( mt );
  51. }
  52. void
  53. __indirect_glLoadTransposeMatrixfARB( const GLfloat * m )
  54. {
  55. GLfloat mt[16];
  56. TransposeMatrixf( m, mt );
  57. __indirect_glLoadMatrixf( mt );
  58. }
  59. void
  60. __indirect_glMultTransposeMatrixdARB( const GLdouble * m )
  61. {
  62. GLdouble mt[16];
  63. TransposeMatrixd( m, mt );
  64. __indirect_glMultMatrixd( mt );
  65. }
  66. void
  67. __indirect_glMultTransposeMatrixfARB( const GLfloat * m )
  68. {
  69. GLfloat mt[16];
  70. TransposeMatrixf( m, mt );
  71. __indirect_glMultMatrixf( mt );
  72. }