Project

General

Profile

« Previous | Next » 

Revision 9db7b0e5

Added by Leszek Koltunski almost 3 years ago

New 'Jing' cubit shapes.

View differences:

src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
58 58
    private static final float SQ2 = (float)Math.sqrt(2);
59 59
    private static final float SQ3 = (float)Math.sqrt(3);
60 60
    private static final float SQ5 = (float)Math.sqrt(5);
61
    private static final float SQ6 = (float)Math.sqrt(6);
61 62
    private final float DEFAULT_SCALE = 0.3f;
62 63

  
63 64
    private final GLSurfaceView mView;
......
253 254

  
254 255
    private void createMesh()
255 256
      {
256
      int mode = 13;
257
      int mode = 16;
257 258
      int numComponents = 0;
258 259
      double[][] vertices = null;
259 260
      int[][] vertIndexes = null;
......
1067 1068
        numComponents = 9;
1068 1069
        }
1069 1070

  
1071
      ///// JING CORNER ///////////////////////////////////////////////////////////////
1072

  
1073
      else if( mode==14 )
1074
        {
1075
        final float F = 0.2f;
1076

  
1077
        vertices = new double[][]
1078
          {
1079
             { 0.0   ,     0.0, 0.0},
1080
             { -F    ,     0.0, 0.0},
1081
             { -F/2  ,     0.0, -F*SQ3/2},
1082
             { -3*F/2,     0.0, -F*SQ3/2},
1083
             { -F/2  , F*SQ6/3, -F*SQ3/6},
1084
             { -3*F/2, F*SQ6/3, -F*SQ3/6},
1085
             { -F    , F*SQ6/3, -F*2*SQ3/3},
1086
             { -2*F  , F*SQ6/3, -F*2*SQ3/3}
1087
          };
1088

  
1089
        vertIndexes = new int[][]
1090
          {
1091
             {3,2,0,1},
1092
             {1,0,4,5},
1093
             {0,2,6,4},
1094
             {5,4,6,7},
1095
             {3,1,5,7},
1096
             {2,3,7,6}
1097
          };
1098

  
1099
        bands = new float[][]
1100
          {
1101
             {0.015f,35,0.5f*F,F,5,1,1},
1102
             {0.001f,35,0.5f*F,F,5,1,1}
1103
          };
1104

  
1105
        bandIndexes = new int[] { 0,0,0,1,1,1 };
1106

  
1107
        corners = new float[][]
1108
          {
1109
            {0.10f,0.20f*F},
1110
            {0.07f,0.20f*F}
1111
          };
1112

  
1113
        cornerIndexes = new int[] { 0,1,1,-1,1,-1,-1,-1 };
1114

  
1115
        centers = new float[][]
1116
          {
1117
             { -2*F/3  , F*SQ6/9, -F*2*SQ3/9}
1118
          };
1119

  
1120
        centerIndexes = new int[] { 0,0,0,-1,0,-1,-1,-1 };
1121

  
1122
        numComponents = 6;
1123
        }
1124

  
1125
      ///// JING EDGE ///////////////////////////////////////////////////////////////
1126

  
1127
      else if( mode==15 )
1128
        {
1129
        final float F = 0.2f;
1130

  
1131
        vertices = new double[][]
1132
          {
1133
             { 0.5-3*F/2,     0.0, -F*SQ3/2  },
1134
             { 0.5-F    ,     0.0,        0.0},
1135
             { 0.5-3*F/2, F*SQ6/3, -F*SQ3/6  },
1136
             { 0.5-2*F  , F*SQ6/3, -F*2*SQ3/3},
1137
             {-0.5+3*F/2,     0.0, -F*SQ3/2  },
1138
             {-0.5+F    ,     0.0,        0.0},
1139
             {-0.5+3*F/2, F*SQ6/3, -F*SQ3/6  },
1140
             {-0.5+2*F  , F*SQ6/3, -F*2*SQ3/3}
1141
          };
1142

  
1143
        vertIndexes = new int[][]
1144
          {
1145
             {5,1,2,6},
1146
             {4,0,1,5},
1147
             {6,2,3,7},
1148
             {7,3,0,4},
1149
             {3,2,1,0},
1150
             {4,5,6,7}
1151
          };
1152

  
1153
        bands = new float[][]
1154
          {
1155
             {0.015f,35,0.5f*F,F,5,1,1},
1156
             {0.001f,35,0.5f*F,F,5,1,1}
1157
          };
1158

  
1159
        bandIndexes = new int[] { 0,0,1,1,1,1 };
1160

  
1161
        corners = new float[][]
1162
          {
1163
            {0.07f,0.20f*F}
1164
          };
1165

  
1166
        cornerIndexes = new int[] { 0,0,0,-1,0,0,0,-1 };
1167

  
1168
        centers = new float[][]
1169
          {
1170
             { 0, F*SQ6/6, -F*SQ3/3 }
1171
          };
1172

  
1173
        centerIndexes = new int[] { 0,0,0,-1,0,0,0,-1 };
1174

  
1175
        numComponents = 6;
1176
        }
1177

  
1178
      ///// JING FACE ///////////////////////////////////////////////////////////////
1179

  
1180
      else if( mode==16 )
1181
        {
1182
        final float F = 0.2f;
1183

  
1184
        vertices = new double[][]
1185
          {
1186
             {    -0.5*(1-3*F),     0.0, (SQ3/6)*(1-3*F) },
1187
             {     0.5*(1-3*F),     0.0, (SQ3/6)*(1-3*F) },
1188
             {             0.0,     0.0,-(SQ3/3)*(1-3*F) },
1189
             { F/2-0.5*(1-3*F), F*SQ6/3, (SQ3/6)*(1-3*F) - F*SQ3/6 },
1190
             {-F/2+0.5*(1-3*F), F*SQ6/3, (SQ3/6)*(1-3*F) - F*SQ3/6 },
1191
             {             0.0, F*SQ6/3,-(SQ3/3)*(1-3*F) + F*SQ3/3 },
1192
          };
1193

  
1194
        vertIndexes = new int[][]
1195
          {
1196
             {2,1,0},
1197
             {3,4,5},
1198
             {0,1,4,3},
1199
             {1,2,5,4},
1200
             {2,0,3,5}
1201
          };
1202

  
1203
        bands = new float[][]
1204
          {
1205
             {0.025f,35,0.2f*(1-3*F),0.6f*(1-3*F),5,1,1},
1206
             {0.001f,35,0.2f*(1-3*F),0.6f*(1-3*F),5,1,1}
1207
          };
1208

  
1209
        bandIndexes = new int[] { 0,1,1,1,1,1 };
1210

  
1211
        corners = new float[][]
1212
          {
1213
            {0.05f,0.20f*F}
1214
          };
1215

  
1216
        cornerIndexes = new int[] { 0,0,0,-1,-1,-1 };
1217

  
1218
        centers = new float[][]
1219
          {
1220
            {0.0f, (1-3*F)*SQ6/3, 0.0f}
1221
          };
1222

  
1223
        centerIndexes = new int[] { 0,0,0,-1,-1,-1 };
1224

  
1225
        numComponents = 6;
1226
        }
1227

  
1070 1228
      ///// END DEFINITIONS /////////////////////////////////////////////////////////////////
1071 1229

  
1072 1230
      FactoryCubit factory = FactoryCubit.getInstance();

Also available in: Unified diff