Revision 78ff6ea9
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/library/effectqueue/EffectQueueVertex.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
private static final int INDEX = EffectType.VERTEX.ordinal(); |
40 | 40 |
|
41 |
private static int[] mNumEffectsH = new int[MAIN_VARIANTS];
|
|
42 |
private static int[] mInflateH = new int[MAIN_VARIANTS];
|
|
43 |
private static int[] mPropertiesH = new int[MAIN_VARIANTS];
|
|
44 |
private static int[] mUniformsH = new int[MAIN_VARIANTS];
|
|
41 |
private final static int[] mNumEffectsH = new int[MAIN_VARIANTS];
|
|
42 |
private final static int[] mInflateH = new int[MAIN_VARIANTS];
|
|
43 |
private final static int[] mUniformsH = new int[MAIN_VARIANTS];
|
|
44 |
private final static int[] mPropBlockIndex= new int[MAIN_VARIANTS];
|
|
45 | 45 |
|
46 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 47 |
|
... | ... | |
61 | 61 |
|
62 | 62 |
static void uniforms(int mProgramH, int variant) |
63 | 63 |
{ |
64 |
mNumEffectsH[variant]= GLES30.glGetUniformLocation( mProgramH, "vNumEffects");
|
|
65 |
mInflateH[variant] = GLES30.glGetUniformLocation( mProgramH, "u_Inflate");
|
|
66 |
mPropertiesH[variant]= GLES30.glGetUniformLocation( mProgramH, "vProperties");
|
|
67 |
mUniformsH[variant] = GLES30.glGetUniformLocation( mProgramH, "vUniforms");
|
|
64 |
mNumEffectsH[variant] = GLES30.glGetUniformLocation ( mProgramH, "vNumEffects");
|
|
65 |
mInflateH[variant] = GLES30.glGetUniformLocation ( mProgramH, "u_Inflate");
|
|
66 |
mUniformsH[variant] = GLES30.glGetUniformLocation ( mProgramH, "vUniforms");
|
|
67 |
mPropBlockIndex[variant] = GLES30.glGetUniformBlockIndex( mProgramH, "vUniformProperties");
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
96 | 96 |
* |
97 | 97 |
* @y.exclude |
98 | 98 |
*/ |
99 |
public void send(float inflate, int variant) |
|
99 |
public void send(float inflate, int programH, int variant)
|
|
100 | 100 |
{ |
101 | 101 |
GLES30.glUniform1i( mNumEffectsH[variant], mNumEffects); |
102 | 102 |
GLES30.glUniform1f( mInflateH[variant] , inflate ); |
103 | 103 |
|
104 | 104 |
if( mNumEffects>0 ) |
105 | 105 |
{ |
106 |
GLES30.glUniform4iv( mPropertiesH[variant], mNumEffects, mIntUniforms , 0); |
|
106 |
int index = mUBP.getIndex(); |
|
107 |
GLES30.glBindBufferBase(GLES30.GL_UNIFORM_BUFFER, PROP_VERT_UBO_BINDING, index); |
|
108 |
GLES30.glUniformBlockBinding(programH, mPropBlockIndex[variant], PROP_VERT_UBO_BINDING); |
|
107 | 109 |
GLES30.glUniform4fv( mUniformsH[variant] ,(NUM_FLOAT_UNIFORMS/4)*mNumEffects, mFloatUniforms , 0); |
108 | 110 |
} |
109 | 111 |
} |
Also available in: Unified diff
Convert the Integer part (i.e. effect names and the two associations) of vertex and fragment shaders to Uniform Buffer Objects.
Next: convert the last part, i.e. the float effect parameters.