Project

General

Profile

« Previous | Next » 

Revision 57ef6378

Added by Leszek Koltunski over 2 years ago

Float vertices - scratchbook

View differences:

src/main/java/org/distorted/objectlib/json/JsonReader.java
144 144
    mNumCubitVariants = object.length();
145 145
    mVariantFaceColor = new int[mNumCubitVariants][];
146 146
    mShapes = new ObjectShape[mNumCubitVariants];
147
    double[][][] verts = new double[mNumCubitVariants][][];
147
    float[][][] verts     = new float[mNumCubitVariants][][];
148
    float[][][] bands     = new float[mNumCubitVariants][][];
149
    float[][][] corners   = new float[mNumCubitVariants][][];
150
    float[][][] centers   = new float[mNumCubitVariants][][];
151
    float[][] convexity   = new float[mNumCubitVariants][];
148 152
    int[][] cornerIndices = new int[mNumCubitVariants][];
149 153
    int[][] centerIndices = new int[mNumCubitVariants][];
150
    int[][] bandIndices = new int[mNumCubitVariants][];
154
    int[][] bandIndices   = new int[mNumCubitVariants][];
151 155
    int[][][] vertIndices = new int[mNumCubitVariants][][];
152
    float[][][] bands = new float[mNumCubitVariants][][];
153
    float[][][] corners = new float[mNumCubitVariants][][];
154
    float[][][] centers = new float[mNumCubitVariants][][];
155
    float[][] convexity = new float[mNumCubitVariants][];
156 156

  
157 157
    mNumCubitFaces = -1;
158 158

  
......
163 163
      ////// vertices /////////////////////////////////////////////////
164 164
      JSONArray jsonVertices= jsonShape.getJSONArray("vertices");
165 165
      int numVertices = jsonVertices.length();
166
      verts[i] = new double[numVertices][3];
166
      verts[i] = new float[numVertices][3];
167 167
      cornerIndices[i] = new int[numVertices];
168 168
      centerIndices[i] = new int[numVertices];
169 169

  
170 170
      for(int j=0; j<numVertices; j++)
171 171
        {
172 172
        JSONObject vert = jsonVertices.getJSONObject(j);
173
        verts[i][j][0] = vert.getDouble("x");
174
        verts[i][j][1] = vert.getDouble("y");
175
        verts[i][j][2] = vert.getDouble("z");
173
        verts[i][j][0] = (float)vert.getDouble("x");
174
        verts[i][j][1] = (float)vert.getDouble("y");
175
        verts[i][j][2] = (float)vert.getDouble("z");
176 176
        cornerIndices[i][j] = vert.getInt("cornerIndex");
177 177
        centerIndices[i][j] = vert.getInt("centerIndex");
178 178
        }

Also available in: Unified diff