| 69 |
69 |
private float mBoundingX, mBoundingY, mBoundingZ;
|
| 70 |
70 |
private float mStretchX, mStretchY, mStretchZ;
|
| 71 |
71 |
|
| 72 |
|
private class Component
|
|
72 |
private static class Component
|
| 73 |
73 |
{
|
| 74 |
74 |
private int mEndIndex;
|
| 75 |
75 |
private Static4D mTextureMap;
|
| ... | ... | |
| 284 |
284 |
*/
|
| 285 |
285 |
public int getTFO()
|
| 286 |
286 |
{
|
| 287 |
|
return mTFO.mIndex[0];
|
|
287 |
return mTFO.getIndex();
|
| 288 |
288 |
}
|
| 289 |
289 |
|
| 290 |
290 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| ... | ... | |
| 306 |
306 |
*/
|
| 307 |
307 |
public void bindVertexAttribs(DistortedProgram program)
|
| 308 |
308 |
{
|
| 309 |
|
mVBO.createImmediately(mNumVertices*VERT_SIZE, mVertAttribs);
|
|
309 |
int index = mVBO.createImmediately(mNumVertices*VERT_SIZE, mVertAttribs);
|
| 310 |
310 |
|
| 311 |
|
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mVBO.mIndex[0] );
|
|
311 |
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, index );
|
| 312 |
312 |
GLES31.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_POS);
|
| 313 |
313 |
GLES31.glVertexAttribPointer(program.mAttribute[1], NOR_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_NOR);
|
| 314 |
314 |
GLES31.glVertexAttribPointer(program.mAttribute[2], INF_DATA_SIZE, GLES31.GL_FLOAT, false, VERT_SIZE, OFFSET_INF);
|
| ... | ... | |
| 324 |
324 |
*/
|
| 325 |
325 |
public void bindTransformAttribs(DistortedProgram program)
|
| 326 |
326 |
{
|
| 327 |
|
mTFO.createImmediately(mNumVertices*TRAN_SIZE, null);
|
|
327 |
int index = mTFO.createImmediately(mNumVertices*TRAN_SIZE, null);
|
| 328 |
328 |
|
| 329 |
|
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mTFO.mIndex[0] );
|
|
329 |
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, index );
|
| 330 |
330 |
GLES31.glVertexAttribPointer(program.mAttribute[0], POS_DATA_SIZE, GLES31.GL_FLOAT, false, 0, 0);
|
| 331 |
331 |
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, 0);
|
| 332 |
332 |
}
|
| ... | ... | |
| 453 |
453 |
}
|
| 454 |
454 |
}
|
| 455 |
455 |
|
| 456 |
|
mTFO.invalidate();
|
|
456 |
mVBO.invalidate();
|
| 457 |
457 |
}
|
| 458 |
458 |
|
| 459 |
459 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| ... | ... | |
| 482 |
482 |
int num_maps = maps.length;
|
| 483 |
483 |
int min = Math.min(num_comp, num_maps);
|
| 484 |
484 |
int vertex = 0;
|
| 485 |
|
int index = TEX_ATTRIB;
|
| 486 |
485 |
Static4D newMap, oldMap;
|
| 487 |
486 |
Component comp;
|
| 488 |
487 |
float newW, newH, ratW, ratH, movX, movY;
|
| ... | ... | |
| 490 |
489 |
for(int i=0; i<min; i++)
|
| 491 |
490 |
{
|
| 492 |
491 |
newMap = maps[i];
|
|
492 |
comp = mComponent.get(i);
|
| 493 |
493 |
|
| 494 |
494 |
if( newMap!=null )
|
| 495 |
495 |
{
|
| ... | ... | |
| 498 |
498 |
|
| 499 |
499 |
if( newW!=0.0f && newH!=0.0f )
|
| 500 |
500 |
{
|
| 501 |
|
comp = mComponent.get(i);
|
| 502 |
501 |
oldMap = comp.mTextureMap;
|
| 503 |
502 |
ratW = newW/oldMap.get2();
|
| 504 |
503 |
ratH = newH/oldMap.get3();
|
| 505 |
504 |
movX = newMap.get0() - ratW*oldMap.get0();
|
| 506 |
505 |
movY = newMap.get1() - ratH*oldMap.get1();
|
| 507 |
506 |
|
| 508 |
|
for( ; vertex<=comp.mEndIndex; vertex++, index+=VERT_ATTRIBS)
|
|
507 |
for( int index=vertex*VERT_ATTRIBS+TEX_ATTRIB ; vertex<=comp.mEndIndex; vertex++, index+=VERT_ATTRIBS)
|
| 509 |
508 |
{
|
| 510 |
509 |
mVertAttribs[index ] = ratW*mVertAttribs[index ] + movX;
|
| 511 |
510 |
mVertAttribs[index+1] = ratH*mVertAttribs[index+1] + movY;
|
| ... | ... | |
| 513 |
512 |
comp.setMap(newMap);
|
| 514 |
513 |
}
|
| 515 |
514 |
}
|
|
515 |
|
|
516 |
vertex= comp.mEndIndex+1;
|
| 516 |
517 |
}
|
| 517 |
518 |
|
| 518 |
|
mTFO.invalidate();
|
|
519 |
mVBO.invalidate();
|
| 519 |
520 |
}
|
| 520 |
521 |
|
| 521 |
522 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Bugfixes in MeshBase:
1) improper buffer was being invalidated after apply and setTextureMap (TFO rather than VBO!)
2) setTextureMap would only work if all components were being set