LCOV - code coverage report
Current view: top level - source/collada - Maths.cpp (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 11 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2009 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #include "precompiled.h"
      19             : 
      20             : #include "Maths.h"
      21             : 
      22             : #include "FCollada.h"
      23             : 
      24             : 
      25           0 : void DumpMatrix(const FMMatrix44& m)
      26             : {
      27           0 :     Log(LOG_INFO, "\n[%f %f %f %f]\n[%f %f %f %f]\n[%f %f %f %f]\n[%f %f %f %f]",
      28           0 :         m.m[0][0], m.m[0][1], m.m[0][2], m.m[0][3],
      29           0 :         m.m[1][0], m.m[1][1], m.m[1][2], m.m[1][3],
      30           0 :         m.m[2][0], m.m[2][1], m.m[2][2], m.m[2][3],
      31           0 :         m.m[3][0], m.m[3][1], m.m[3][2], m.m[3][3]
      32             :     );
      33           0 : }
      34             : 
      35           0 : FMMatrix44 DecomposeToScaleMatrix(const FMMatrix44& m)
      36             : {
      37           0 :     FMVector3 scale, rotation, translation;
      38             :     float inverted;
      39           0 :     m.Decompose(scale, rotation, translation, inverted);
      40           0 :     return FMMatrix44::ScaleMatrix(scale);
      41             : }
      42             : 
      43             : /*
      44             : FMMatrix44 operator+ (const FMMatrix44& a, const FMMatrix44& b)
      45             : {
      46             :     FMMatrix44 r;
      47             :     for (int x = 0; x < 4; ++x)
      48             :         for (int y = 0; y < 4; ++y)
      49             :             r[x][y] = a[x][y] + b[x][y];
      50             :     return r;
      51             : }
      52             : 
      53             : FMMatrix44 operator/ (const FMMatrix44& a, const float b)
      54             : {
      55             :     FMMatrix44 r;
      56             :     for (int x = 0; x < 4; ++x)
      57             :         for (int y = 0; y < 4; ++y)
      58             :             r[x][y] = a[x][y] / b;
      59             :     return r;
      60             : }
      61             : 
      62             : FMMatrix44 QuatToMatrix(float x, float y, float z, float w)
      63             : {
      64             :     FMMatrix44 r;
      65             : 
      66             :     r[0][0] = 1.0f - (y*y*2 + z*z*2);
      67             :     r[1][0] = x*y*2 - w*z*2;
      68             :     r[2][0] = x*z*2 + w*y*2;
      69             :     r[3][0] = 0;
      70             : 
      71             :     r[0][1] = x*y*2 + w*z*2;
      72             :     r[1][1] = 1.0f - (x*x*2 + z*z*2);
      73             :     r[2][1] = y*z*2 - w*x*2;
      74             :     r[3][1] = 0;
      75             : 
      76             :     r[0][2] = x*z*2 - w*y*2;
      77             :     r[1][2] = y*z*2 + w*x*2;
      78             :     r[2][2] = 1.0f - (x*x*2 + y*y*2);
      79             :     r[3][2] = 0;
      80             : 
      81             :     r[0][3] = 0;
      82             :     r[1][3] = 0;
      83             :     r[2][3] = 0;
      84             :     r[3][3] = 1;
      85             : 
      86             :     return r;
      87             : }
      88             : */

Generated by: LCOV version 1.13