Revision b455eb48
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedObject.java | ||
---|---|---|
54 | 54 |
* <li> Fragment Effects, i.e. effects that change (some of) the pixels of the Bitmap (transparency, macroblock) |
55 | 55 |
* </ul> |
56 | 56 |
* <p> |
57 |
* Just like in DistortedNode and DistortedFramebuffer, we need to have a static list of all
|
|
57 |
* Just like in DistortedObjectTree and DistortedFramebuffer, we need to have a static list of all
|
|
58 | 58 |
* DistortedObjects currently created by the application so that we can implement the 'mark for |
59 | 59 |
* deletion now - actually delete on next render' thing. |
60 | 60 |
* We need to be able to quickly retrieve an Object by its ID, thus a HashMap. |
... | ... | |
70 | 70 |
|
71 | 71 |
private boolean matrixCloned, vertexCloned, fragmentCloned; |
72 | 72 |
private long mID; |
73 |
private int mSizeX, mSizeY, mSizeZ; // in screen space |
|
74 |
private float mHalfX, mHalfY, mHalfZ; // halfs of the above
|
|
73 |
private int mSizeX, mSizeY, mSizeZ; // in screen space
|
|
74 |
private float mHalfX, mHalfY, mHalfZ; // halves of the above
|
|
75 | 75 |
|
76 | 76 |
private Bitmap[] mBmp= null; // |
77 | 77 |
int[] mTextureDataH; // have to be shared among all the cloned Objects |
... | ... | |
84 | 84 |
// upper-left corner. Everywhere else the origin is in the lower-left corner. Thus we have to flip. |
85 | 85 |
// The alternative solution, namely inverting the y-coordinate of the TexCoord does not really work- |
86 | 86 |
// i.e. it works only in case of rendering directly to the screen, but if we render to an FBO and |
87 |
// then take the FBO and render to screen, (DistortedNode does so!) things get inverted as textures
|
|
87 |
// then take the FBO and render to screen, (DistortedObjectTree does so!) things get inverted as textures
|
|
88 | 88 |
// created from FBO have their origins in the lower-left... Mindfuck! |
89 | 89 |
|
90 | 90 |
private static Bitmap flipBitmap(Bitmap src) |
... | ... | |
184 | 184 |
|
185 | 185 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
186 | 186 |
|
187 |
void drawPriv(long currTime, DistortedObjectGrid grid, DistortedFramebuffer df)
|
|
187 |
void drawPriv(long currTime, GridObject grid, DistortedFramebuffer df)
|
|
188 | 188 |
{ |
189 | 189 |
DistortedFramebuffer.deleteAllMarked(); |
190 | 190 |
|
... | ... | |
204 | 204 |
|
205 | 205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
206 | 206 |
|
207 |
void drawNoEffectsPriv(DistortedObjectGrid grid, DistortedFramebuffer df)
|
|
207 |
void drawNoEffectsPriv(GridObject grid, DistortedFramebuffer df)
|
|
208 | 208 |
{ |
209 | 209 |
GLES20.glViewport(0, 0, df.mWidth, df.mHeight); |
210 | 210 |
|
... | ... | |
324 | 324 |
* This gets passed on to Dynamics inside the Effects that are currently applied to the |
325 | 325 |
* Object. |
326 | 326 |
*/ |
327 |
public void draw(long currTime, DistortedObjectGrid grid)
|
|
327 |
public void draw(long currTime, GridObject grid)
|
|
328 | 328 |
{ |
329 | 329 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); |
330 | 330 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
... | ... | |
338 | 338 |
* @param currTime Current time, in milliseconds. |
339 | 339 |
* @param df Framebuffer to render this to. |
340 | 340 |
*/ |
341 |
public void draw(long currTime, DistortedObjectGrid grid, DistortedFramebuffer df)
|
|
341 |
public void draw(long currTime, GridObject grid, DistortedFramebuffer df)
|
|
342 | 342 |
{ |
343 | 343 |
df.setAsOutput(); |
344 | 344 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
Also available in: Unified diff
Rename various classes; fix a bug in Around the World.