Project

General

Profile

« Previous | Next » 

Revision aee078f8

Added by Leszek Koltunski almost 4 years ago

Correct VertexEffectQueue in the Mesh. There's no need to have a separate Queue in every component.

View differences:

src/main/java/org/distorted/library/mesh/MeshBase.java
88 88
   private int[] mAssociation;
89 89

  
90 90
   private static int[] mComponentAssociationH = new int[EffectQueue.MAIN_VARIANTS];
91
   private EffectQueueVertex mQueue;
91 92

  
92 93
   private static class Component
93 94
     {
94 95
     private int mEndIndex;
95 96
     private Static4D mTextureMap;
96
     private EffectQueueVertex mQueue;
97 97

  
98 98
     Component(int end)
99 99
       {
100 100
       mEndIndex  = end;
101 101
       mTextureMap= new Static4D(0,0,1,1);
102
       mQueue     = new EffectQueueVertex();
103 102
       }
104 103
     Component(Component original)
105 104
       {
......
110 109
       float z = original.mTextureMap.get2();
111 110
       float w = original.mTextureMap.get3();
112 111
       mTextureMap = new Static4D(x,y,z,w);
113
       mQueue = new EffectQueueVertex(original.mQueue);
114 112
       }
115 113

  
116 114
     void setMap(Static4D map)
......
133 131
     for(int i=0; i<MAX_COMPONENTS; i++) mAssociation[i] = DEFAULT_ASSOCIATION;
134 132

  
135 133
     mNeedsAdjustment = new boolean[1];
134
     mQueue = new EffectQueueVertex();
136 135

  
137 136
     mVBO1= new InternalBuffer(GLES30.GL_ARRAY_BUFFER             , GLES30.GL_STATIC_READ);
138 137
     mVBO2= new InternalBuffer(GLES30.GL_ARRAY_BUFFER             , GLES30.GL_STATIC_READ);
......
150 149

  
151 150
     int size = original.mComponent.size();
152 151
     mComponent = new ArrayList<>();
152
     mQueue = new EffectQueueVertex(original.mQueue);
153 153

  
154 154
     for(int i=0; i<size; i++)
155 155
       {
......
363 363

  
364 364
     GLES30.glUnmapBuffer(GLES30.GL_TRANSFORM_FEEDBACK);
365 365

  
366
     int numComp = mComponent.size();
367

  
368
     for(int i=0; i<numComp; i++)
369
       {
370
       mComponent.get(i).mQueue.removeAll(false);
371
       }
366
     mQueue.removeAll(false);
372 367
     }
373 368

  
374 369
///////////////////////////////////////////////////////////////////////////////////////////////////
......
379 374
 */
380 375
   public void computeQueue()
381 376
     {
382
     int numComp = mComponent.size();
383

  
384
     for(int i=0; i<numComp; i++)
385
       {
386
       mComponent.get(i).mQueue.compute(1);
387
       }
377
     mQueue.compute(1);
388 378
     }
389 379

  
390 380
///////////////////////////////////////////////////////////////////////////////////////////////////
......
395 385
 */
396 386
   public void sendQueue()
397 387
     {
398
     int numComp = mComponent.size();
399

  
400
     for(int i=0; i<numComp; i++)
401
       {
402
       mComponent.get(i).mQueue.send(0.0f,3);
403
       }
388
     mQueue.send(0.0f,3);
404 389
     }
405 390

  
406 391
///////////////////////////////////////////////////////////////////////////////////////////////////
......
573 558
 */
574 559
   public void apply(VertexEffect effect)
575 560
     {
576
     int numComp = mComponent.size();
577

  
578
     for(int i=0; i<numComp; i++)
579
       {
580
       mComponent.get(i).mQueue.add(effect);
581
       }
582

  
561
     mQueue.add(effect);
583 562
     mNeedsAdjustment[0] = true;
584 563
     }
585 564

  
src/main/java/org/distorted/library/mesh/MeshCubes.java
941 941
 *
942 942
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
943 943
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
944
 *             coordinates and effect assocciations, is always deep copied).
944
 *             coordinates and effect associations, is always deep copied).
945 945
 */
946 946
 public MeshCubes copy(boolean deep)
947 947
   {
src/main/java/org/distorted/library/mesh/MeshJoined.java
50 50
 *
51 51
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
52 52
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
53
 *             coordinates and effect assocciations, is always deep copied)
53
 *             coordinates and effect associations, is always deep copied)
54 54
 */
55 55
  public MeshJoined copy(boolean deep)
56 56
   {
src/main/java/org/distorted/library/mesh/MeshQuad.java
84 84
 *
85 85
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
86 86
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
87
 *             coordinates and effect assocciations, is always deep copied)
87
 *             coordinates and effect associations, is always deep copied)
88 88
 */
89 89
  public MeshQuad copy(boolean deep)
90 90
    {
src/main/java/org/distorted/library/mesh/MeshRectangles.java
187 187
 *
188 188
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
189 189
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
190
 *             coordinates and effect assocciations, is always deep copied)
190
 *             coordinates and effect associations, is always deep copied)
191 191
 */
192 192
  public MeshRectangles copy(boolean deep)
193 193
    {
src/main/java/org/distorted/library/mesh/MeshSphere.java
285 285
 *
286 286
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
287 287
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
288
 *             coordinates and effect assocciations, is always deep copied)
288
 *             coordinates and effect associations, is always deep copied)
289 289
 */
290 290
  public MeshSphere copy(boolean deep)
291 291
    {
src/main/java/org/distorted/library/mesh/MeshTriangles.java
137 137
 *
138 138
 * @param deep If to be a deep or shallow copy of mVertAttribs1, i.e. the array holding vertices,
139 139
 *             normals and inflates (the rest, in particular the mVertAttribs2 containing texture
140
 *             coordinates and effect assocciations, is always deep copied)
140
 *             coordinates and effect associations, is always deep copied)
141 141
 */
142 142
  public MeshTriangles copy(boolean deep)
143 143
    {

Also available in: Unified diff