Project

General

Profile

« Previous | Next » 

Revision e92785ba

Added by Leszek Koltunski about 6 years ago

Small things.

View differences:

src/main/java/org/distorted/library/mesh/MeshBase.java
57 57
   ////////////////////////////////////////////////////////////////////////////////
58 58
   // derived classes need to compute and fill up those 2 variables with data
59 59
   // describing a particular shape. Having done so, call setData()
60
   int numVertices;
60
   int mNumVertices;
61 61
   FloatBuffer mVertAttribs;   // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, TexS,TexT
62 62
   ////////////////////////////////////////////////////////////////////////////////
63 63

  
......
75 75
///////////////////////////////////////////////////////////////////////////////////////////////////
76 76
// when a derived class is done computing its mesh, it has to call this method.
77 77

  
78
   void setData(int size, FloatBuffer buffer)
78
   void setData(int numVertices, FloatBuffer vertAttribs)
79 79
     {
80
     mVBO.setData(size*VERTSIZE, buffer);
81
     mTFO.setData(size*TFSIZE  , null  );
80
     mVBO.setData(numVertices*VERTSIZE, vertAttribs);
81
     mTFO.setData(numVertices*TFSIZE  , null       );
82 82
     }
83 83

  
84 84
///////////////////////////////////////////////////////////////////////////////////////////////////
......
111 111
 */
112 112
   public int getNumVertices()
113 113
     {
114
     return numVertices;
114
     return mNumVertices;
115 115
     }
116 116

  
117 117
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/mesh/MeshCubes.java
180 180

  
181 181
   private void prepareDataStructures(int cols, String desc, int slices)
182 182
     {
183
     mRows      =0;
184
     mCols      =0;
185
     mSlices    =slices;
186
     numVertices=0;
183
     mRows       =0;
184
     mCols       =0;
185
     mSlices     =slices;
186
     mNumVertices=0;
187 187
     
188 188
     if( cols>0 && desc.contains("1") )
189 189
       {
......
197 197
           mCubes[i][j] = (desc.charAt(i*mCols+j) == '1' ? 1:0);
198 198

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

  
202
       remainingVert = numVertices;
202
       remainingVert = mNumVertices;
203 203
       }
204 204
     }
205 205

  
......
208 208

  
209 209
   private void prepareDataStructures(int cols, int rows, int slices)
210 210
     {
211
     mRows       =rows;
212
     mCols       =cols;
213
     mSlices     =slices;
214
     numVertices =   0;
211
     mRows        =rows;
212
     mCols        =cols;
213
     mSlices      =slices;
214
     mNumVertices =   0;
215 215

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

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

  
227
       remainingVert = numVertices;
227
       remainingVert = mNumVertices;
228 228
       }
229 229
     }
230 230

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

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

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

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

  
719
     setData(numVertices, mVertAttribs);
719
     setData(mNumVertices, mVertAttribs);
720 720
     }
721 721

  
722 722
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/mesh/MeshFlat.java
44 44

  
45 45
     if( cols==1 && rows==1 )
46 46
       {
47
       numVertices = 4;
47
       mNumVertices = 4;
48 48
       }
49 49
     else
50 50
       {
51
       numVertices = 2*( mRows*mCols +2*mRows - 1) +2*(mCols>=2 ? mRows:0) +
51
       mNumVertices = 2*( mRows*mCols +2*mRows - 1) +2*(mCols>=2 ? mRows:0) +
52 52
                     (mCols>=2 && mRows>=2 ? 2*mRows-2 : 1);
53 53
       }
54 54

  
55 55
     //android.util.Log.e("MeshFlat","vertices="+numVertices+" rows="+mRows+" cols="+mCols);
56 56

  
57
     remainingVert = numVertices;
57
     remainingVert = mNumVertices;
58 58
     }
59 59

  
60 60

  
......
178 178
    super(0.0f);
179 179
    computeNumberOfVertices(cols,rows);
180 180

  
181
    float[] attribs= new float[(POS_DATA_SIZE+NOR_DATA_SIZE+TEX_DATA_SIZE)*numVertices];
181
    float[] attribs= new float[(POS_DATA_SIZE+NOR_DATA_SIZE+TEX_DATA_SIZE)*mNumVertices];
182 182

  
183 183
    buildGrid(attribs);
184 184

  
......
188 188
    if( remainingVert!=0 )
189 189
      android.util.Log.d("MeshFlat", "remainingVert " +remainingVert );
190 190

  
191
    mVertAttribs = ByteBuffer.allocateDirect(numVertices*VERTSIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
191
    mVertAttribs = ByteBuffer.allocateDirect(mNumVertices*VERTSIZE).order(ByteOrder.nativeOrder()).asFloatBuffer();
192 192
    mVertAttribs.put(attribs).position(0);
193 193

  
194
    setData(numVertices, mVertAttribs);
194
    setData(mNumVertices, mVertAttribs);
195 195
    }
196 196
 }

Also available in: Unified diff