LCOV - code coverage report
Current view: top level - source/renderer - BlendShapes.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 77 0.0 %
Date: 2026-12-03 01:19:39 Functions: 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             : #ifndef INCLUDED_BLENDSHAPES
      19             : #define INCLUDED_BLENDSHAPES
      20             : 
      21             : #include <cstring>
      22             : 
      23             : struct BlendShape4
      24             : {
      25             : public:
      26           0 :     BlendShape4() {}
      27             :     BlendShape4(int a,int b,int c,int d) {
      28             :         m_Data[0]=a; m_Data[1]=b; m_Data[2]=c; m_Data[3]=d;
      29             :     }
      30             : 
      31             :     int& operator[](int index) { return m_Data[index]; }
      32             :     const int& operator[](int index) const { return m_Data[index]; }
      33             : 
      34           0 :     bool operator==(const BlendShape4& lhs) const {
      35           0 :         return memcmp(m_Data,lhs.m_Data,sizeof(BlendShape4))==0;
      36             :     }
      37             : 
      38           0 :     void Rotate90(BlendShape4& dst) const {
      39           0 :         dst[0]=m_Data[3];
      40           0 :         dst[1]=m_Data[0];
      41           0 :         dst[2]=m_Data[1];
      42           0 :         dst[3]=m_Data[2];
      43             :     }
      44             : 
      45           0 :     void Rotate180(BlendShape4& dst) const {
      46           0 :         dst[0]=m_Data[2];
      47           0 :         dst[1]=m_Data[3];
      48           0 :         dst[2]=m_Data[0];
      49           0 :         dst[3]=m_Data[1];
      50             :     }
      51             : 
      52           0 :     void Rotate270(BlendShape4& dst) const {
      53           0 :         dst[0]=m_Data[1];
      54           0 :         dst[1]=m_Data[2];
      55           0 :         dst[2]=m_Data[3];
      56           0 :         dst[3]=m_Data[0];
      57             :     }
      58             : 
      59           0 :     void FlipU(BlendShape4& dst) const {
      60           0 :         dst[0]=m_Data[2];
      61           0 :         dst[1]=m_Data[1];
      62           0 :         dst[2]=m_Data[0];
      63           0 :         dst[3]=m_Data[3];
      64             :     }
      65             : 
      66           0 :     void FlipV(BlendShape4& dst) const {
      67           0 :         dst[0]=m_Data[0];
      68           0 :         dst[1]=m_Data[3];
      69           0 :         dst[2]=m_Data[2];
      70           0 :         dst[3]=m_Data[1];
      71             :     }
      72             : 
      73             : private:
      74             :     int m_Data[4];
      75             : };
      76             : 
      77             : 
      78             : struct BlendShape8
      79             : {
      80             : public:
      81           0 :     BlendShape8() {}
      82             :     BlendShape8(int a,int b,int c,int d,int e,int f,int g,int h) {
      83             :         m_Data[0]=a; m_Data[1]=b; m_Data[2]=c; m_Data[3]=d;
      84             :         m_Data[4]=e; m_Data[5]=f; m_Data[6]=g; m_Data[7]=h;
      85             :     }
      86             : 
      87           0 :     int& operator[](size_t index) { return m_Data[index]; }
      88             :     const int& operator[](size_t index) const { return m_Data[index]; }
      89             : 
      90           0 :     bool operator==(const BlendShape8& lhs) const {
      91           0 :         return memcmp(m_Data,lhs.m_Data,sizeof(BlendShape8))==0;
      92             :     }
      93             : 
      94           0 :     void Rotate90(BlendShape8& dst) const {
      95           0 :         dst[0]=m_Data[6];
      96           0 :         dst[1]=m_Data[7];
      97           0 :         dst[2]=m_Data[0];
      98           0 :         dst[3]=m_Data[1];
      99           0 :         dst[4]=m_Data[2];
     100           0 :         dst[5]=m_Data[3];
     101           0 :         dst[6]=m_Data[4];
     102           0 :         dst[7]=m_Data[5];
     103             :     }
     104             : 
     105           0 :     void Rotate180(BlendShape8& dst) const {
     106           0 :         dst[0]=m_Data[4];
     107           0 :         dst[1]=m_Data[5];
     108           0 :         dst[2]=m_Data[6];
     109           0 :         dst[3]=m_Data[7];
     110           0 :         dst[4]=m_Data[0];
     111           0 :         dst[5]=m_Data[1];
     112           0 :         dst[6]=m_Data[2];
     113           0 :         dst[7]=m_Data[3];
     114             :     }
     115             : 
     116           0 :     void Rotate270(BlendShape8& dst) const {
     117           0 :         dst[0]=m_Data[2];
     118           0 :         dst[1]=m_Data[3];
     119           0 :         dst[2]=m_Data[4];
     120           0 :         dst[3]=m_Data[5];
     121           0 :         dst[4]=m_Data[6];
     122           0 :         dst[5]=m_Data[7];
     123           0 :         dst[6]=m_Data[0];
     124           0 :         dst[7]=m_Data[1];
     125             :     }
     126             : 
     127           0 :     void FlipU(BlendShape8& dst) const {
     128           0 :         dst[0]=m_Data[4];
     129           0 :         dst[1]=m_Data[3];
     130           0 :         dst[2]=m_Data[2];
     131           0 :         dst[3]=m_Data[1];
     132           0 :         dst[4]=m_Data[0];
     133           0 :         dst[5]=m_Data[7];
     134           0 :         dst[6]=m_Data[6];
     135           0 :         dst[7]=m_Data[5];
     136             :     }
     137             : 
     138           0 :     void FlipV(BlendShape8& dst) const {
     139           0 :         dst[0]=m_Data[0];
     140           0 :         dst[1]=m_Data[7];
     141           0 :         dst[2]=m_Data[6];
     142           0 :         dst[3]=m_Data[5];
     143           0 :         dst[4]=m_Data[4];
     144           0 :         dst[5]=m_Data[3];
     145           0 :         dst[6]=m_Data[2];
     146           0 :         dst[7]=m_Data[1];
     147             :     }
     148             : 
     149             : private:
     150             :     int m_Data[8];
     151             : };
     152             : 
     153             : #endif

Generated by: LCOV version 1.16