Revision 0a046359
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/library/DistortedObject.java | ||
---|---|---|
71 | 71 |
private boolean matrixCloned, vertexCloned, fragmentCloned; |
72 | 72 |
private long mID; |
73 | 73 |
private int mSizeX, mSizeY, mSizeZ; // in screen space |
74 |
private int mHalfX, mHalfY, mHalfZ; // halfs of the above |
|
74 | 75 |
|
75 | 76 |
protected DistortedObjectGrid mGrid = null; |
76 | 77 |
|
... | ... | |
104 | 105 |
|
105 | 106 |
protected void initializeData(int x, int y, int z) |
106 | 107 |
{ |
107 |
mSizeX= x; |
|
108 |
mSizeY= y; |
|
109 |
mSizeZ= z; |
|
108 |
mSizeX= x; mHalfX = x/2;
|
|
109 |
mSizeY= y; mHalfY = y/2;
|
|
110 |
mSizeZ= z; mHalfZ = z/2;
|
|
110 | 111 |
|
111 | 112 |
mID = mNextID++; |
112 | 113 |
mObjects.put(mID,this); |
... | ... | |
127 | 128 |
|
128 | 129 |
private void initializeEffectLists(DistortedObject d, int flags) |
129 | 130 |
{ |
131 |
long objID = d.getID(); |
|
132 |
|
|
130 | 133 |
if( (flags & Distorted.CLONE_MATRIX) != 0 ) |
131 | 134 |
{ |
132 | 135 |
mM = d.mM; |
... | ... | |
134 | 137 |
} |
135 | 138 |
else |
136 | 139 |
{ |
137 |
mM = new EffectQueueMatrix(d);
|
|
140 |
mM = new EffectQueueMatrix(objID);
|
|
138 | 141 |
matrixCloned = false; |
139 | 142 |
} |
140 | 143 |
|
... | ... | |
145 | 148 |
} |
146 | 149 |
else |
147 | 150 |
{ |
148 |
mV = new EffectQueueVertex(d);
|
|
151 |
mV = new EffectQueueVertex(objID);
|
|
149 | 152 |
vertexCloned = false; |
150 | 153 |
} |
151 | 154 |
|
... | ... | |
156 | 159 |
} |
157 | 160 |
else |
158 | 161 |
{ |
159 |
mF = new EffectQueueFragment(d);
|
|
162 |
mF = new EffectQueueFragment(objID);
|
|
160 | 163 |
fragmentCloned = false; |
161 | 164 |
} |
162 | 165 |
} |
... | ... | |
192 | 195 |
DistortedFramebuffer.deleteAllMarked(); |
193 | 196 |
|
194 | 197 |
GLES20.glViewport(0, 0, df.mWidth, df.mHeight); |
195 |
|
|
198 |
|
|
196 | 199 |
mM.compute(currTime); |
197 |
mM.send(df); |
|
200 |
mM.send(df,mHalfX,mHalfY,mHalfZ);
|
|
198 | 201 |
|
199 | 202 |
mV.compute(currTime); |
200 |
mV.send(); |
|
203 |
mV.send(mHalfX,mHalfY,mHalfZ);
|
|
201 | 204 |
|
202 | 205 |
mF.compute(currTime); |
203 |
mF.send(); |
|
206 |
mF.send(mHalfX,mHalfY);
|
|
204 | 207 |
|
205 | 208 |
mGrid.draw(); |
206 | 209 |
} |
... | ... | |
210 | 213 |
void drawNoEffectsPriv(DistortedFramebuffer df) |
211 | 214 |
{ |
212 | 215 |
GLES20.glViewport(0, 0, df.mWidth, df.mHeight); |
213 |
mM.sendZero(df); |
|
216 |
|
|
217 |
mM.sendZero(df,mHalfX,mHalfY,mHalfZ); |
|
214 | 218 |
mV.sendZero(); |
215 | 219 |
mF.sendZero(); |
216 | 220 |
mGrid.draw(); |
... | ... | |
295 | 299 |
mSizeX = dc.mSizeX; |
296 | 300 |
mSizeY = dc.mSizeY; |
297 | 301 |
mSizeZ = dc.mSizeZ; |
302 |
mHalfX = dc.mHalfX; |
|
303 |
mHalfY = dc.mHalfY; |
|
304 |
mHalfZ = dc.mHalfZ; |
|
298 | 305 |
mGrid = dc.mGrid; |
299 | 306 |
|
300 | 307 |
if( (flags & Distorted.CLONE_BITMAP) != 0 ) |
... | ... | |
368 | 375 |
public void setBitmap(Bitmap bmp) |
369 | 376 |
{ |
370 | 377 |
mBitmapSet[0] = true; |
371 |
|
|
378 |
|
|
379 |
mSizeX= bmp.getWidth() ; mHalfX = mSizeX/2; |
|
380 |
mSizeY= bmp.getHeight(); mHalfY = mSizeY/2; |
|
381 |
|
|
372 | 382 |
if( Distorted.isInitialized() ) |
373 | 383 |
{ |
374 | 384 |
GLES20.glActiveTexture(GLES20.GL_TEXTURE0); |
src/main/java/org/distorted/library/EffectQueue.java | ||
---|---|---|
31 | 31 |
{ |
32 | 32 |
protected byte mNumEffects; // number of effects at the moment |
33 | 33 |
protected long mTotalEffects; // total number of effects ever created |
34 |
|
|
35 | 34 |
protected int[] mName; |
36 | 35 |
protected float[] mUniforms; |
36 |
protected float[] mCache; |
|
37 | 37 |
protected Dynamic[][] mInter; |
38 | 38 |
protected long[] mCurrentDuration; |
39 | 39 |
protected byte[] mFreeIndexes; |
40 | 40 |
protected byte[] mIDIndex; |
41 | 41 |
protected long[] mID; |
42 |
|
|
43 | 42 |
protected long mTime=0; |
44 |
protected float mObjHalfX, mObjHalfY, mObjHalfZ; |
|
45 |
|
|
46 | 43 |
protected static int[] mMax = new int[EffectTypes.LENGTH]; |
47 | 44 |
protected int mMaxIndex; |
48 |
|
|
49 | 45 |
protected Vector<EffectListener> mListeners =null; |
50 | 46 |
protected int mNumListeners=0; // ==mListeners.length(), but we only create mListeners if the first one gets added |
51 | 47 |
protected long mObjectID; |
... | ... | |
59 | 55 |
|
60 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 57 |
|
62 |
EffectQueue(DistortedObject obj, int numUniforms, int index)
|
|
58 |
EffectQueue(long id, int numUniforms, int numCache, int index)
|
|
63 | 59 |
{ |
64 | 60 |
mNumEffects = 0; |
65 | 61 |
mTotalEffects = 0; |
66 | 62 |
mMaxIndex = index; |
67 |
|
|
68 |
if( obj!=null ) |
|
69 |
{ |
|
70 |
mObjHalfX = obj.getWidth() / 2.0f; |
|
71 |
mObjHalfY = obj.getHeight()/ 2.0f; |
|
72 |
mObjHalfZ = obj.getDepth() / 2.0f; |
|
73 |
mObjectID = obj.getID(); |
|
74 |
} |
|
63 |
mObjectID = id; |
|
75 | 64 |
|
76 | 65 |
if( mMax[mMaxIndex]>0 ) |
77 | 66 |
{ |
... | ... | |
84 | 73 |
mFreeIndexes = new byte[mMax[mMaxIndex]]; |
85 | 74 |
|
86 | 75 |
for(byte i=0; i<mMax[mMaxIndex]; i++) mFreeIndexes[i] = i; |
76 |
|
|
77 |
if( numCache>0 ) |
|
78 |
{ |
|
79 |
mCache = new float[numCache*mMax[mMaxIndex]]; |
|
80 |
} |
|
87 | 81 |
} |
88 | 82 |
|
89 | 83 |
mCreated = true; |
src/main/java/org/distorted/library/EffectQueueFragment.java | ||
---|---|---|
37 | 37 |
class EffectQueueFragment extends EffectQueue |
38 | 38 |
{ |
39 | 39 |
private static final int NUM_UNIFORMS = 8; |
40 |
private static final int NUM_CACHE = 4; |
|
40 | 41 |
private static final int INDEX = EffectTypes.FRAGMENT.ordinal(); |
41 | 42 |
private static int mNumEffectsH; |
42 | 43 |
private static int mTypeH; |
... | ... | |
44 | 45 |
|
45 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 47 |
|
47 |
EffectQueueFragment(DistortedObject obj)
|
|
48 |
EffectQueueFragment(long id)
|
|
48 | 49 |
{ |
49 |
super(obj,NUM_UNIFORMS,INDEX);
|
|
50 |
super(id,NUM_UNIFORMS,NUM_CACHE,INDEX);
|
|
50 | 51 |
} |
51 | 52 |
|
52 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
87 | 88 |
else mInter[0][i] = null; |
88 | 89 |
} |
89 | 90 |
|
90 |
if( mInter[1][i]!=null ) |
|
91 |
{ |
|
92 |
mInter[1][i].interpolateMain( mUniforms, NUM_UNIFORMS*i+4, mCurrentDuration[i], step); |
|
93 |
|
|
94 |
mUniforms[NUM_UNIFORMS*i+4] = mUniforms[NUM_UNIFORMS*i+4]-mObjHalfX; |
|
95 |
mUniforms[NUM_UNIFORMS*i+5] =-mUniforms[NUM_UNIFORMS*i+5]+mObjHalfY; |
|
96 |
} |
|
97 |
|
|
98 |
if( mInter[2][i]!=null ) mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+1, mCurrentDuration[i], step); |
|
91 |
if( mInter[1][i]!=null ) mInter[1][i].interpolateMain( mCache , NUM_CACHE*i , mCurrentDuration[i], step); |
|
92 |
if( mInter[2][i]!=null ) mInter[2][i].interpolateMain( mUniforms, NUM_UNIFORMS*i+1, mCurrentDuration[i], step); |
|
99 | 93 |
|
100 | 94 |
mCurrentDuration[i] += step; |
101 | 95 |
} |
... | ... | |
112 | 106 |
mUniforms[NUM_UNIFORMS*index+2] = mUniforms[NUM_UNIFORMS*(index+1)+2]; |
113 | 107 |
mUniforms[NUM_UNIFORMS*index+3] = mUniforms[NUM_UNIFORMS*(index+1)+3]; |
114 | 108 |
|
115 |
if( mInter[1][index]==null ) |
|
116 |
{ |
|
117 |
mUniforms[NUM_UNIFORMS*index+4] = mUniforms[NUM_UNIFORMS*(index+1)+4]; |
|
118 |
mUniforms[NUM_UNIFORMS*index+5] = mUniforms[NUM_UNIFORMS*(index+1)+5]; |
|
119 |
mUniforms[NUM_UNIFORMS*index+6] = mUniforms[NUM_UNIFORMS*(index+1)+6]; |
|
120 |
mUniforms[NUM_UNIFORMS*index+7] = mUniforms[NUM_UNIFORMS*(index+1)+7]; |
|
121 |
} |
|
109 |
mCache[NUM_CACHE*index ] = mCache[NUM_CACHE*(index+1) ]; |
|
110 |
mCache[NUM_CACHE*index+1] = mCache[NUM_CACHE*(index+1)+1]; |
|
111 |
mCache[NUM_CACHE*index+2] = mCache[NUM_CACHE*(index+1)+2]; |
|
112 |
mCache[NUM_CACHE*index+3] = mCache[NUM_CACHE*(index+1)+3]; |
|
122 | 113 |
} |
123 | 114 |
|
124 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 116 |
|
126 |
synchronized void send()
|
|
117 |
synchronized void send(int halfX, int halfY)
|
|
127 | 118 |
{ |
128 | 119 |
GLES20.glUniform1i( mNumEffectsH, mNumEffects); |
129 |
|
|
120 |
|
|
130 | 121 |
if( mNumEffects>0 ) |
131 |
{ |
|
122 |
{ |
|
123 |
for(int i=0; i<mNumEffects; i++) |
|
124 |
{ |
|
125 |
mUniforms[NUM_UNIFORMS*i+4] = mCache[NUM_CACHE*i ]-halfX; |
|
126 |
mUniforms[NUM_UNIFORMS*i+5] =-mCache[NUM_CACHE*i+1]+halfY; |
|
127 |
mUniforms[NUM_UNIFORMS*i+6] = mCache[NUM_CACHE*i+2]; |
|
128 |
mUniforms[NUM_UNIFORMS*i+7] = mCache[NUM_CACHE*i+3]; |
|
129 |
} |
|
130 |
|
|
132 | 131 |
GLES20.glUniform1iv( mTypeH , mNumEffects, mName ,0); |
133 | 132 |
GLES20.glUniform4fv( mUniformsH,2*mNumEffects, mUniforms,0); |
134 | 133 |
} |
... | ... | |
162 | 161 |
else return -1; |
163 | 162 |
|
164 | 163 |
mInter[1][mNumEffects] = null; |
165 |
mUniforms[NUM_UNIFORMS*mNumEffects+6] = Float.MAX_VALUE;
|
|
166 |
mUniforms[NUM_UNIFORMS*mNumEffects+7] = Float.MAX_VALUE;
|
|
164 |
mCache[NUM_CACHE*mNumEffects+2] = Float.MAX_VALUE;
|
|
165 |
mCache[NUM_CACHE*mNumEffects+3] = Float.MAX_VALUE;
|
|
167 | 166 |
|
168 | 167 |
mInter[2][mNumEffects] = null; |
169 | 168 |
|
... | ... | |
200 | 199 |
else if( region instanceof Static4D ) |
201 | 200 |
{ |
202 | 201 |
mInter[1][mNumEffects] = null; |
203 |
mUniforms[NUM_UNIFORMS*mNumEffects+4] = ((Static4D)region).getX()-mObjHalfX;
|
|
204 |
mUniforms[NUM_UNIFORMS*mNumEffects+5] =-((Static4D)region).getY()+mObjHalfY;
|
|
205 |
mUniforms[NUM_UNIFORMS*mNumEffects+6] = ((Static4D)region).getZ();
|
|
206 |
mUniforms[NUM_UNIFORMS*mNumEffects+7] = ((Static4D)region).getW();
|
|
202 |
mCache[NUM_CACHE*mNumEffects ] = ((Static4D)region).getX();
|
|
203 |
mCache[NUM_CACHE*mNumEffects+1] = ((Static4D)region).getY();
|
|
204 |
mCache[NUM_CACHE*mNumEffects+2] = ((Static4D)region).getZ();
|
|
205 |
mCache[NUM_CACHE*mNumEffects+3] = ((Static4D)region).getW();
|
|
207 | 206 |
} |
208 | 207 |
else return -1; |
209 | 208 |
|
... | ... | |
255 | 254 |
else if( region instanceof Static4D ) |
256 | 255 |
{ |
257 | 256 |
mInter[1][mNumEffects] = null; |
258 |
mUniforms[NUM_UNIFORMS*mNumEffects+4] = ((Static4D)region).getX()-mObjHalfX;
|
|
259 |
mUniforms[NUM_UNIFORMS*mNumEffects+5] =-((Static4D)region).getY()+mObjHalfY;
|
|
260 |
mUniforms[NUM_UNIFORMS*mNumEffects+6] = ((Static4D)region).getZ();
|
|
261 |
mUniforms[NUM_UNIFORMS*mNumEffects+7] = ((Static4D)region).getW();
|
|
257 |
mCache[NUM_CACHE*mNumEffects ] = ((Static4D)region).getX();
|
|
258 |
mCache[NUM_CACHE*mNumEffects+1] = ((Static4D)region).getY();
|
|
259 |
mCache[NUM_CACHE*mNumEffects+2] = ((Static4D)region).getZ();
|
|
260 |
mCache[NUM_CACHE*mNumEffects+3] = ((Static4D)region).getW();
|
|
262 | 261 |
} |
263 | 262 |
else return -1; |
264 | 263 |
|
... | ... | |
302 | 301 |
else return -1; |
303 | 302 |
|
304 | 303 |
mInter[1][mNumEffects] = null; |
305 |
mUniforms[NUM_UNIFORMS*mNumEffects+6] = Float.MAX_VALUE;
|
|
306 |
mUniforms[NUM_UNIFORMS*mNumEffects+7] = Float.MAX_VALUE;
|
|
304 |
mCache[NUM_CACHE*mNumEffects+2] = Float.MAX_VALUE;
|
|
305 |
mCache[NUM_CACHE*mNumEffects+3] = Float.MAX_VALUE;
|
|
307 | 306 |
|
308 | 307 |
return addBase(eln); |
309 | 308 |
} |
src/main/java/org/distorted/library/EffectQueueMatrix.java | ||
---|---|---|
39 | 39 |
class EffectQueueMatrix extends EffectQueue |
40 | 40 |
{ |
41 | 41 |
private static final int NUM_UNIFORMS = 7; |
42 |
private static final int NUM_CACHE = 0; |
|
42 | 43 |
private static final int INDEX = EffectTypes.MATRIX.ordinal(); |
43 | 44 |
|
44 | 45 |
private static float[] mMVPMatrix = new float[16]; |
... | ... | |
52 | 53 |
|
53 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
54 | 55 |
|
55 |
EffectQueueMatrix(DistortedObject obj)
|
|
56 |
EffectQueueMatrix(long id)
|
|
56 | 57 |
{ |
57 |
super(obj,NUM_UNIFORMS, INDEX );
|
|
58 |
super(id,NUM_UNIFORMS,NUM_CACHE,INDEX );
|
|
58 | 59 |
} |
59 | 60 |
|
60 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
153 | 154 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
154 | 155 |
// here construct the ModelView Matrix |
155 | 156 |
|
156 |
synchronized void send(DistortedFramebuffer df) |
|
157 |
synchronized void send(DistortedFramebuffer df, int halfX, int halfY, int halfZ)
|
|
157 | 158 |
{ |
158 | 159 |
Matrix.setIdentityM(mViewMatrix, 0); |
159 | 160 |
Matrix.translateM(mViewMatrix, 0, -df.mWidth/2, df.mHeight/2, -df.mDistance); |
... | ... | |
229 | 230 |
} |
230 | 231 |
} |
231 | 232 |
|
232 |
Matrix.translateM(mViewMatrix, 0, mObjHalfX,-mObjHalfY, 0);
|
|
233 |
Matrix.translateM(mViewMatrix, 0, halfX,-halfY, 0);
|
|
233 | 234 |
Matrix.multiplyMM(mMVPMatrix, 0, df.mProjectionMatrix, 0, mViewMatrix, 0); |
234 | 235 |
|
235 |
GLES20.glUniform3f( mObjDH , mObjHalfX, mObjHalfY, mObjHalfZ);
|
|
236 |
GLES20.glUniform3f( mObjDH , halfX, halfY, halfZ);
|
|
236 | 237 |
GLES20.glUniform1f( mDepthH, df.mDepth); |
237 | 238 |
GLES20.glUniformMatrix4fv(mMVMatrixH , 1, false, mViewMatrix, 0); |
238 | 239 |
GLES20.glUniformMatrix4fv(mMVPMatrixH, 1, false, mMVPMatrix , 0); |
... | ... | |
241 | 242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
242 | 243 |
// here construct the ModelView Matrix, but without any effects |
243 | 244 |
|
244 |
synchronized void sendZero(DistortedFramebuffer df) |
|
245 |
synchronized void sendZero(DistortedFramebuffer df, int halfX, int halfY, int halfZ)
|
|
245 | 246 |
{ |
246 | 247 |
Matrix.setIdentityM(mTmpMatrix, 0); |
247 |
Matrix.translateM(mTmpMatrix, 0, mObjHalfX-df.mWidth/2, df.mHeight/2-mObjHalfY, -df.mDistance);
|
|
248 |
Matrix.translateM(mTmpMatrix, 0, halfX-df.mWidth/2, df.mHeight/2-halfY, -df.mDistance);
|
|
248 | 249 |
Matrix.multiplyMM(mMVPMatrix, 0, df.mProjectionMatrix, 0, mTmpMatrix, 0); |
249 | 250 |
|
250 |
GLES20.glUniform3f( mObjDH , mObjHalfX, mObjHalfY, mObjHalfZ);
|
|
251 |
GLES20.glUniform3f( mObjDH , halfX, halfY, halfZ);
|
|
251 | 252 |
GLES20.glUniform1f( mDepthH, df.mDepth); |
252 | 253 |
GLES20.glUniformMatrix4fv(mMVMatrixH , 1, false, mTmpMatrix, 0); |
253 | 254 |
GLES20.glUniformMatrix4fv(mMVPMatrixH, 1, false, mMVPMatrix, 0); |
src/main/java/org/distorted/library/EffectQueueVertex.java | ||
---|---|---|
43 | 43 |
class EffectQueueVertex extends EffectQueue |
44 | 44 |
{ |
45 | 45 |
private static final int NUM_UNIFORMS = 12; |
46 |
private static final int NUM_CACHE = 3; |
|
46 | 47 |
private static final int INDEX = EffectTypes.VERTEX.ordinal(); |
47 | 48 |
private static int mNumEffectsH; |
48 | 49 |
private static int mTypeH; |
... | ... | |
50 | 51 |
|
51 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 53 |
|
53 |
EffectQueueVertex(DistortedObject obj)
|
|
54 |
EffectQueueVertex(long id)
|
|
54 | 55 |
{ |
55 |
super(obj,NUM_UNIFORMS,INDEX);
|
|
56 |
super(id,NUM_UNIFORMS,NUM_CACHE,INDEX);
|
|
56 | 57 |
} |
57 | 58 |
|
58 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
102 | 103 |
} |
103 | 104 |
} |
104 | 105 |
|
105 |
if( mInter[1][i]!=null ) // region |
|
106 |
{ |
|
107 |
mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+8, mCurrentDuration[i], step); |
|
108 |
} |
|
109 |
|
|
110 |
if( mInter[2][i]!=null ) // center |
|
111 |
{ |
|
112 |
mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+5, mCurrentDuration[i], step); |
|
113 |
|
|
114 |
mUniforms[NUM_UNIFORMS*i+5] = mUniforms[NUM_UNIFORMS*i+5]-mObjHalfX; |
|
115 |
mUniforms[NUM_UNIFORMS*i+6] =-mUniforms[NUM_UNIFORMS*i+6]+mObjHalfY; |
|
116 |
mUniforms[NUM_UNIFORMS*i+7] = mUniforms[NUM_UNIFORMS*i+7]-mObjHalfZ; |
|
117 |
} |
|
106 |
if( mInter[1][i]!=null ) mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+8, mCurrentDuration[i], step); |
|
107 |
if( mInter[2][i]!=null ) mInter[2][i].interpolateMain(mCache , NUM_CACHE*i , mCurrentDuration[i], step); |
|
118 | 108 |
|
119 | 109 |
mCurrentDuration[i] += step; |
120 | 110 |
} |
... | ... | |
131 | 121 |
mUniforms[NUM_UNIFORMS*index+ 2] = mUniforms[NUM_UNIFORMS*(index+1)+ 2]; |
132 | 122 |
mUniforms[NUM_UNIFORMS*index+ 3] = mUniforms[NUM_UNIFORMS*(index+1)+ 3]; |
133 | 123 |
mUniforms[NUM_UNIFORMS*index+ 4] = mUniforms[NUM_UNIFORMS*(index+1)+ 4]; |
134 |
mUniforms[NUM_UNIFORMS*index+ 5] = mUniforms[NUM_UNIFORMS*(index+1)+ 5]; |
|
135 |
mUniforms[NUM_UNIFORMS*index+ 6] = mUniforms[NUM_UNIFORMS*(index+1)+ 6]; |
|
136 |
mUniforms[NUM_UNIFORMS*index+ 7] = mUniforms[NUM_UNIFORMS*(index+1)+ 7]; |
|
124 |
|
|
125 |
mCache[NUM_CACHE*index ] = mCache[NUM_CACHE*(index+1) ]; |
|
126 |
mCache[NUM_CACHE*index+1] = mCache[NUM_CACHE*(index+1)+1]; |
|
127 |
mCache[NUM_CACHE*index+2] = mCache[NUM_CACHE*(index+1)+2]; |
|
128 |
|
|
137 | 129 |
mUniforms[NUM_UNIFORMS*index+ 8] = mUniforms[NUM_UNIFORMS*(index+1)+ 8]; |
138 | 130 |
mUniforms[NUM_UNIFORMS*index+ 9] = mUniforms[NUM_UNIFORMS*(index+1)+ 9]; |
139 | 131 |
mUniforms[NUM_UNIFORMS*index+10] = mUniforms[NUM_UNIFORMS*(index+1)+10]; |
... | ... | |
142 | 134 |
|
143 | 135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 136 |
|
145 |
synchronized void send()
|
|
137 |
synchronized void send(int halfX, int halfY, int halfZ)
|
|
146 | 138 |
{ |
147 | 139 |
GLES20.glUniform1i( mNumEffectsH, mNumEffects); |
148 | 140 |
|
149 | 141 |
if( mNumEffects>0 ) |
150 |
{ |
|
142 |
{ |
|
143 |
for(int i=0; i<mNumEffects; i++) |
|
144 |
{ |
|
145 |
mUniforms[NUM_UNIFORMS*i+5] = mCache[NUM_CACHE*i ]-halfX; |
|
146 |
mUniforms[NUM_UNIFORMS*i+6] =-mCache[NUM_CACHE*i+1]+halfY; |
|
147 |
mUniforms[NUM_UNIFORMS*i+7] = mCache[NUM_CACHE*i+2]-halfZ; |
|
148 |
} |
|
149 |
|
|
151 | 150 |
GLES20.glUniform1iv( mTypeH , mNumEffects, mName ,0); |
152 | 151 |
GLES20.glUniform4fv( mUniformsH,3*mNumEffects, mUniforms,0); |
153 | 152 |
} |
... | ... | |
391 | 390 |
else if( center instanceof Static3D) |
392 | 391 |
{ |
393 | 392 |
mInter[2][mNumEffects] = null; |
394 |
mUniforms[NUM_UNIFORMS*mNumEffects+5] = ((Static3D)center).getX()-mObjHalfX;
|
|
395 |
mUniforms[NUM_UNIFORMS*mNumEffects+6] =-((Static3D)center).getY()+mObjHalfY;
|
|
396 |
mUniforms[NUM_UNIFORMS*mNumEffects+7] = ((Static3D)center).getZ()-mObjHalfZ;
|
|
393 |
mCache[NUM_CACHE*mNumEffects ] = ((Static3D)center).getX();
|
|
394 |
mCache[NUM_CACHE*mNumEffects+1] = ((Static3D)center).getY();
|
|
395 |
mCache[NUM_CACHE*mNumEffects+2] = ((Static3D)center).getZ();
|
|
397 | 396 |
} |
398 | 397 |
|
399 | 398 |
long ret= addBase(eln); |
Also available in: Unified diff
The EffectQueues are now totally independent of the size of the underlying Bitmap.