Project

General

Profile

Download (5.62 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / objects / TwistyBandagedFused.java @ 4c0a6d97

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objects;
21

    
22
import android.content.res.Resources;
23

    
24
import org.distorted.library.main.DistortedEffects;
25
import org.distorted.library.main.DistortedTexture;
26
import org.distorted.library.mesh.MeshSquare;
27
import org.distorted.library.type.Static3D;
28
import org.distorted.library.type.Static4D;
29
import org.distorted.main.R;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

    
33
class TwistyBandagedFused extends TwistyBandagedCube
34
{
35
  TwistyBandagedFused(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
36
                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
37
    {
38
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN1, res, scrWidth);
39
    }
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

    
43
  int getNumCubitVariants()
44
    {
45
    return 2;
46
    }
47

    
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

    
50
  int getCubitVariant(int cubit)
51
    {
52
    return cubit==0 ? 0:1;
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  int getNumCubits()
58
    {
59
    return 20;
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  int[] getCubitDimensions(int variant)
65
    {
66
    return variant==0 ? new int[] {2,2,2} : new int[] {1,1,1};
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  Static3D getCubitPosition(int cubit)
72
    {
73
    switch(cubit)
74
      {
75
      case  0: return new Static3D(-0.5f, -0.5f, +0.5f);
76
      case  1: return new Static3D(-1.0f, +1.0f, +1.0f);
77
      case  2: return new Static3D(-1.0f, +1.0f, +0.0f);
78
      case  3: return new Static3D(-1.0f, +1.0f, -1.0f);
79
      case  4: return new Static3D( 0.0f, +1.0f, +1.0f);
80
      case  5: return new Static3D( 0.0f, +1.0f, +0.0f);
81
      case  6: return new Static3D( 0.0f, +1.0f, -1.0f);
82
      case  7: return new Static3D( 1.0f, +1.0f, +1.0f);
83
      case  8: return new Static3D( 1.0f, +1.0f, +0.0f);
84
      case  9: return new Static3D( 1.0f, +1.0f, -1.0f);
85
      case 10: return new Static3D( 1.0f,  0.0f, +1.0f);
86
      case 11: return new Static3D( 1.0f,  0.0f, +0.0f);
87
      case 12: return new Static3D( 1.0f,  0.0f, -1.0f);
88
      case 13: return new Static3D( 1.0f, -1.0f, +1.0f);
89
      case 14: return new Static3D( 1.0f, -1.0f, +0.0f);
90
      case 15: return new Static3D( 1.0f, -1.0f, -1.0f);
91
      case 16: return new Static3D(-1.0f, -1.0f, -1.0f);
92
      case 17: return new Static3D(-1.0f,  0.0f, -1.0f);
93
      case 18: return new Static3D( 0.0f, -1.0f, -1.0f);
94
      case 19: return new Static3D( 0.0f,  0.0f, -1.0f);
95
      }
96

    
97
    return null;
98
    }
99

    
100
///////////////////////////////////////////////////////////////////////////////////////////////////
101

    
102
  int getQuatIndex(int cubit)
103
    {
104
    return 0;
105
    }
106

    
107
///////////////////////////////////////////////////////////////////////////////////////////////////
108
// PUBLIC API
109
// TODO
110

    
111
  public int getObjectName(int numLayers)
112
    {
113
    switch(numLayers)
114
      {
115
      case 2: return R.string.cube2;
116
      case 3: return R.string.cube3;
117
      case 4: return R.string.cube4;
118
      case 5: return R.string.cube5;
119
      }
120
    return R.string.cube3;
121
    }
122

    
123
///////////////////////////////////////////////////////////////////////////////////////////////////
124
// TODO
125

    
126
  public int getInventor(int numLayers)
127
    {
128
    switch(numLayers)
129
      {
130
      case 2: return R.string.cube2_inventor;
131
      case 3: return R.string.cube3_inventor;
132
      case 4: return R.string.cube4_inventor;
133
      case 5: return R.string.cube5_inventor;
134
      }
135
    return R.string.cube3_inventor;
136
    }
137

    
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139

    
140
  public int getComplexity(int numLayers)
141
    {
142
    return 8;
143
    }
144
}
(17-17/32)