Revision 7aa0ff7b
Added by Leszek Koltunski 11 months ago
| src/main/java/org/distorted/library/uniformblock/UniformBlockAssociation.java | ||
|---|---|---|
| 34 | 34 |
*/ |
| 35 | 35 |
public class UniformBlockAssociation |
| 36 | 36 |
{
|
| 37 |
private static final int DEFAULT_ASSOCIATION = 0xffffffff;
|
|
| 37 |
private static final int DEFAULT_ASSOCIATION = 0x7fffffff; // all effects associated, all components affected
|
|
| 38 | 38 |
private static final int DEFAULT_STRIDE = 4; |
| 39 | 39 |
private static final int LOC_AND = 0; |
| 40 | 40 |
private static final int LOC_EQU = 1; |
| ... | ... | |
| 107 | 107 |
public void setEffectAssociationNow(int comp, int andAssociation, int equAssociation) |
| 108 | 108 |
{
|
| 109 | 109 |
int index = mStride*comp; |
| 110 |
mAssociations[index+LOC_AND] &= 0x8000;
|
|
| 111 |
mAssociations[index+LOC_AND] += (andAssociation & 0x7fff);
|
|
| 110 |
mAssociations[index+LOC_AND] &= (~DEFAULT_ASSOCIATION);
|
|
| 111 |
mAssociations[index+LOC_AND] += (andAssociation & DEFAULT_ASSOCIATION);
|
|
| 112 | 112 |
mAssociations[index+LOC_EQU] = equAssociation; |
| 113 | 113 |
|
| 114 | 114 |
mUBO.invalidate(); |
| ... | ... | |
| 118 | 118 |
|
| 119 | 119 |
public void setNotAffectedComponentsNow(int[] components) |
| 120 | 120 |
{
|
| 121 |
for(int c=0; c<mMax; c++) mAssociations[mStride*c+LOC_AND] &= 0x7fff;
|
|
| 121 |
for(int c=0; c<mMax; c++) mAssociations[mStride*c+LOC_AND] &= DEFAULT_ASSOCIATION;
|
|
| 122 | 122 |
|
| 123 | 123 |
if( components!=null ) |
| 124 | 124 |
{
|
| 125 |
for(int c : components) mAssociations[mStride*c+LOC_AND] |= 0x8000;
|
|
| 125 |
for(int c : components) mAssociations[mStride*c+LOC_AND] |= (~DEFAULT_ASSOCIATION);
|
|
| 126 | 126 |
} |
| 127 | 127 |
|
| 128 | 128 |
mUBO.invalidate(); |
| src/main/res/raw/main_vertex_shader.glsl | ||
|---|---|---|
| 131 | 131 |
#endif |
| 132 | 132 |
|
| 133 | 133 |
#ifdef POSTPROCESS |
| 134 |
if( (vComAssoc[component].x & 0x8000) != 0 ) |
|
| 134 |
if( (vComAssoc[component].x & 0x80000000) != 0 )
|
|
| 135 | 135 |
{
|
| 136 | 136 |
v = vec3(0.0, 0.0, 0.0); |
| 137 | 137 |
} |
| ... | ... | |
| 139 | 139 |
|
| 140 | 140 |
#if NUM_VERTEX>0 |
| 141 | 141 |
int effect=0; |
| 142 |
int andC = vComAssoc[component].x & 0x7fff; |
|
| 142 |
int andC = vComAssoc[component].x & 0x7fffffff;
|
|
| 143 | 143 |
int equC = vComAssoc[component].y; |
| 144 | 144 |
|
| 145 | 145 |
for(int i=0; i<vNumEffects; i++) |
Also available in: Unified diff
Bugfix: for affected components, we were using bit 16, not the intended bit 32. Bit 16 clashes with associations of vertex effects!