Revision 2aeb75aa
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/library/mesh/MeshBase.java | ||
---|---|---|
80 | 80 |
private float[] mVertAttribs1; // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, InfX,InfY,InfZ |
81 | 81 |
private float[] mVertAttribs2; // packed: TexS,TexT, Component |
82 | 82 |
private float mInflate; |
83 |
private int[] mAssociation; |
|
83 |
private int[] mEquAssociation; |
|
84 |
private int[] mAndAssociation; |
|
84 | 85 |
|
85 | 86 |
DeferredJobs.JobNode[] mJobNode; |
86 | 87 |
|
87 |
private static int[] mComponentAssociationH = new int[EffectQueue.MAIN_VARIANTS]; |
|
88 |
private static int[] mEquAssociationH = new int[EffectQueue.MAIN_VARIANTS]; |
|
89 |
private static int[] mAndAssociationH = new int[EffectQueue.MAIN_VARIANTS]; |
|
88 | 90 |
|
89 | 91 |
private static class Component |
90 | 92 |
{ |
... | ... | |
122 | 124 |
mShowNormals= false; |
123 | 125 |
mInflate = 0.0f; |
124 | 126 |
mComponent = new ArrayList<>(); |
125 |
mAssociation= new int[MAX_COMPONENTS]; |
|
127 |
mEquAssociation= new int[MAX_COMPONENTS]; |
|
128 |
mAndAssociation= new int[MAX_COMPONENTS]; |
|
126 | 129 |
|
127 | 130 |
mJobNode = new DeferredJobs.JobNode[1]; |
128 | 131 |
|
129 |
for(int i=0; i<MAX_COMPONENTS; i++) mAssociation[i] = DEFAULT_ASSOCIATION; |
|
132 |
for(int i=0; i<MAX_COMPONENTS; i++) |
|
133 |
{ |
|
134 |
mAndAssociation[i] = DEFAULT_ASSOCIATION; |
|
135 |
mEquAssociation[i] = i; |
|
136 |
} |
|
130 | 137 |
|
131 | 138 |
mVBO1= new InternalBuffer(GLES30.GL_ARRAY_BUFFER , GLES30.GL_STATIC_READ); |
132 | 139 |
mVBO2= new InternalBuffer(GLES30.GL_ARRAY_BUFFER , GLES30.GL_STATIC_READ); |
... | ... | |
142 | 149 |
mInflate = original.mInflate; |
143 | 150 |
mNumVertices= original.mNumVertices; |
144 | 151 |
|
145 |
mAssociation= new int[MAX_COMPONENTS]; |
|
146 |
System.arraycopy(original.mAssociation, 0, mAssociation, 0, MAX_COMPONENTS); |
|
152 |
mAndAssociation= new int[MAX_COMPONENTS]; |
|
153 |
System.arraycopy(original.mAndAssociation, 0, mAndAssociation, 0, MAX_COMPONENTS); |
|
154 |
mEquAssociation= new int[MAX_COMPONENTS]; |
|
155 |
System.arraycopy(original.mEquAssociation, 0, mEquAssociation, 0, MAX_COMPONENTS); |
|
147 | 156 |
|
148 | 157 |
if( deep ) |
149 | 158 |
{ |
... | ... | |
270 | 279 |
|
271 | 280 |
if( origComponents<MAX_COMPONENTS ) |
272 | 281 |
{ |
273 |
mAssociation[origComponents] = mesh.mAssociation[j]; |
|
282 |
mAndAssociation[origComponents] = mesh.mAndAssociation[j]; |
|
283 |
mEquAssociation[origComponents] = mesh.mEquAssociation[j]; |
|
274 | 284 |
origComponents++; |
275 | 285 |
} |
276 | 286 |
} |
... | ... | |
424 | 434 |
|
425 | 435 |
public static void getUniforms(int mProgramH, int variant) |
426 | 436 |
{ |
427 |
mComponentAssociationH[variant] = GLES30.glGetUniformLocation( mProgramH, "vComponAssoc"); |
|
437 |
mEquAssociationH[variant] = GLES30.glGetUniformLocation( mProgramH, "vComEquAssoc"); |
|
438 |
mAndAssociationH[variant] = GLES30.glGetUniformLocation( mProgramH, "vComAndAssoc"); |
|
428 | 439 |
} |
429 | 440 |
|
430 | 441 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
532 | 543 |
*/ |
533 | 544 |
public void send(int variant) |
534 | 545 |
{ |
535 |
GLES30.glUniform1iv( mComponentAssociationH[variant], MAX_COMPONENTS, mAssociation, 0); |
|
546 |
GLES30.glUniform1iv( mEquAssociationH[variant], MAX_COMPONENTS, mEquAssociation, 0); |
|
547 |
GLES30.glUniform1iv( mAndAssociationH[variant], MAX_COMPONENTS, mAndAssociation, 0); |
|
536 | 548 |
} |
537 | 549 |
|
538 | 550 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
721 | 733 |
* Set Effect association. |
722 | 734 |
* |
723 | 735 |
* This creates an association between a Component of this Mesh and a Vertex Effect. |
724 |
* One can set the association of an Effect and of a Component, and the Effect will only be active on
|
|
725 |
* vertices of Components such that |
|
736 |
* One can set two types of associations - an 'logical and' and a 'equal' associations and the Effect
|
|
737 |
* will only be active on vertices of Components such that
|
|
726 | 738 |
* |
727 |
* (effect assoc) & (component assoc) != 0 || (effect component) == (mesh component)
|
|
739 |
* (effect andAssoc) & (component andAssoc) != 0 || (effect equAssoc) == (mesh equAssoc)
|
|
728 | 740 |
* |
729 | 741 |
* (see main_vertex_shader) |
730 | 742 |
* |
731 | 743 |
* The point: this way we can configure the system so that each Vertex Effect acts only on a certain |
732 | 744 |
* subset of a Mesh, thus potentially significantly reducing the number of render calls. |
733 | 745 |
*/ |
734 |
public void setEffectAssociation(int component, int association) |
|
746 |
public void setEffectAssociation(int component, int andAssociation, int equAssociation)
|
|
735 | 747 |
{ |
736 | 748 |
if( component>=0 && component<MAX_COMPONENTS ) |
737 | 749 |
{ |
738 |
mAssociation[component] = association; |
|
750 |
mAndAssociation[component] = andAssociation; |
|
751 |
mEquAssociation[component] = equAssociation; |
|
739 | 752 |
} |
740 | 753 |
} |
741 | 754 |
|
Also available in: Unified diff
Update Myanmar flag.