Revision dbe3079d
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/library/mesh/DeferredJobs.java | ||
---|---|---|
100 | 100 |
break; |
101 | 101 |
case JOB_TYPE_COPY : mTarget.copy(mSource[0]); |
102 | 102 |
break; |
103 |
case JOB_TYPE_TEXTURE : mTarget.textureMap(mMaps); |
|
103 |
case JOB_TYPE_TEXTURE : mTarget.textureMap(mMaps,mComp);
|
|
104 | 104 |
break; |
105 | 105 |
case JOB_TYPE_ASSOC : mTarget.setEffectAssociationNow(mComp,mAndAssoc,mEquAssoc); |
106 | 106 |
break; |
... | ... | |
335 | 335 |
|
336 | 336 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
337 | 337 |
|
338 |
static JobNode textureMap(MeshBase target, Static4D[] maps) |
|
338 |
static JobNode textureMap(MeshBase target, Static4D[] maps, int comp)
|
|
339 | 339 |
{ |
340 | 340 |
JobNode jn = target.mJobNode[0]; |
341 |
Job job = new Job(JOB_TYPE_TEXTURE,target,null,null,null,maps,0,0,0);
|
|
341 |
Job job = new Job(JOB_TYPE_TEXTURE,target,null,null,null,maps,comp,0,0);
|
|
342 | 342 |
JobNode node = new JobNode(job); |
343 | 343 |
node.mPrevJobs.add(jn); |
344 | 344 |
jn.mNextJobs.add(node); |
src/main/java/org/distorted/library/mesh/MeshBase.java | ||
---|---|---|
490 | 490 |
|
491 | 491 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
492 | 492 |
|
493 |
void textureMap(Static4D[] maps) |
|
493 |
void textureMap(Static4D[] maps, int startComponent)
|
|
494 | 494 |
{ |
495 | 495 |
int num_comp = mTexComponent.size(); |
496 | 496 |
int num_maps = maps.length; |
497 |
int min = Math.min(num_comp, num_maps); |
|
497 |
int min = Math.min(num_comp-startComponent, num_maps);
|
|
498 | 498 |
int vertex = 0; |
499 | 499 |
Static4D newMap, oldMap; |
500 | 500 |
TexComponent comp; |
... | ... | |
503 | 503 |
for(int i=0; i<min; i++) |
504 | 504 |
{ |
505 | 505 |
newMap = maps[i]; |
506 |
comp = mTexComponent.get(i); |
|
506 |
comp = mTexComponent.get(i+startComponent);
|
|
507 | 507 |
|
508 | 508 |
if( newMap!=null ) |
509 | 509 |
{ |
... | ... | |
852 | 852 |
* |
853 | 853 |
* A map's width and height have to be non-zero (but can be negative!) |
854 | 854 |
* |
855 |
* @param maps List of texture maps to apply to the texture's components. |
|
855 |
* @param maps List of texture maps to apply to the texture's components. |
|
856 |
* @param startComponent the component the first of the maps refers to. |
|
856 | 857 |
*/ |
857 |
public void setTextureMap(Static4D[] maps) |
|
858 |
public void setTextureMap(Static4D[] maps, int startComponent)
|
|
858 | 859 |
{ |
859 | 860 |
if( mJobNode[0]==null ) |
860 | 861 |
{ |
861 |
textureMap(maps); |
|
862 |
textureMap(maps,startComponent);
|
|
862 | 863 |
} |
863 | 864 |
else |
864 | 865 |
{ |
865 |
mJobNode[0] = DeferredJobs.textureMap(this,maps); |
|
866 |
mJobNode[0] = DeferredJobs.textureMap(this,maps,startComponent);
|
|
866 | 867 |
} |
867 | 868 |
} |
868 | 869 |
|
Also available in: Unified diff
Extend the MeshBase.setTextureMaps API so that we are able to set a single texture map to a single texture component, or a few consecutive at a time, not necessarily starting from component 0.