Project

General

Profile

« Previous | Next » 

Revision da681e7e

Added by Leszek Koltunski over 5 years ago

Some simplifications in Meshes. Hide stuff inside MeshBase.

View differences:

src/main/java/org/distorted/library/mesh/MeshCubes.java
19 19

  
20 20
package org.distorted.library.mesh;
21 21

  
22
import java.nio.ByteBuffer;
23
import java.nio.ByteOrder;
24 22
import java.util.ArrayList;
25 23

  
26 24
///////////////////////////////////////////////////////////////////////////////////////////////////
......
61 59
   private ArrayList<Edge> mEdges = new ArrayList<>();
62 60

  
63 61
   private int remainingVert;
62
   private int numVertices;
64 63
   private int mSideBends;
65 64
   private int mEdgeNum;
66 65
   private int mSideWalls;
......
183 182
     mRows       =0;
184 183
     mCols       =0;
185 184
     mSlices     =slices;
186
     mNumVertices=0;
185
     numVertices =0;
187 186
     
188 187
     if( cols>0 && desc.contains("1") )
189 188
       {
......
197 196
           mCubes[i][j] = (desc.charAt(i*mCols+j) == '1' ? 1:0);
198 197

  
199 198
       markRegions();
200
       mNumVertices = computeDataLength();
201

  
202
       remainingVert = mNumVertices;
199
       numVertices = computeDataLength();
200
       remainingVert = numVertices;
203 201
       }
204 202
     }
205 203

  
......
211 209
     mRows        =rows;
212 210
     mCols        =cols;
213 211
     mSlices      =slices;
214
     mNumVertices =   0;
212
     numVertices  =0;
215 213

  
216 214
     if( cols>0 && rows>0 )
217 215
       {
......
222 220
           mCubes[i][j] = 1;
223 221

  
224 222
       markRegions();
225
       mNumVertices = computeDataLength();
226

  
227
       remainingVert = mNumVertices;
223
       numVertices = computeDataLength();
224
       remainingVert = numVertices;
228 225
       }
229 226
     }
230 227

  
......
691 688
  private void build()
692 689
     {
693 690
     int vertSoFar=0;
694
     float[] attribs= new float[(POS_DATA_SIZE+NOR_DATA_SIZE+TEX_DATA_SIZE)*mNumVertices];
691
     float[] attribs= new float[(POS_DATA_SIZE+NOR_DATA_SIZE+TEX_DATA_SIZE)*numVertices];
695 692

  
696 693
     vertSoFar = buildFrontBackGrid(true, vertSoFar,attribs);
697 694

  
......
713 710
     if( remainingVert!=0 )
714 711
       android.util.Log.e("MeshCubes", "remainingVert " +remainingVert );
715 712

  
716
     mVertAttribs = ByteBuffer.allocateDirect(mNumVertices*VERTSIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
717
     mVertAttribs.put(attribs).position(0);
718

  
719
     setData(mNumVertices, mVertAttribs);
713
     setData(numVertices, attribs);
720 714
     }
721 715

  
722 716
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff