Revision e0b6c593
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
31 | 31 |
* <p> |
32 | 32 |
* User is able to create either Framebuffers from objects already constructed outside |
33 | 33 |
* of the library (the first constructor; primary use case: the screen) or an offscreen |
34 |
* FBOs (used by the DistortedTree, but also can be used by external users of the library)
|
|
34 |
* FBOs.
|
|
35 | 35 |
* <p> |
36 |
* Also, keep all objects created in a static LinkedList. The point: we need to be able to mark
|
|
36 |
* Keep all objects created in a static LinkedList. The point: we need to be able to mark
|
|
37 | 37 |
* Framebuffers for deletion, and delete all marked objects later at a convenient time (that's |
38 | 38 |
* because we can only delete from a thread that holds the OpenGL context so here we provide a |
39 | 39 |
* framework where one is able to mark for deletion at any time and actual deletion takes place |
src/main/java/org/distorted/library/DistortedTexture.java | ||
---|---|---|
28 | 28 |
import java.util.LinkedList; |
29 | 29 |
|
30 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
31 |
|
|
31 |
/** |
|
32 |
* Class which represents a OpenGL Texture object. |
|
33 |
* <p> |
|
34 |
* Create a Texture of arbitrary size and feed some pixels to it via the setTexture() method. |
|
35 |
* <p> |
|
36 |
* Keep all objects created in a static LinkedList. The point: we need to be able to mark |
|
37 |
* Textures for deletion, and delete all marked objects later at a convenient time (that's |
|
38 |
* because we can only delete from a thread that holds the OpenGL context so here we provide a |
|
39 |
* framework where one is able to mark for deletion at any time and actual deletion takes place |
|
40 |
* on the next render). |
|
41 |
*/ |
|
32 | 42 |
public class DistortedTexture |
33 | 43 |
{ |
34 | 44 |
private static boolean mListMarked = false; |
src/main/java/org/distorted/library/GridCubes.java | ||
---|---|---|
24 | 24 |
import java.util.ArrayList; |
25 | 25 |
|
26 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 |
|
|
27 |
/** |
|
28 |
* Create a 3D grid composed of Cubes. |
|
29 |
* <p> |
|
30 |
* Any subset of a MxNx1 cuboid is possible. |
|
31 |
*/ |
|
28 | 32 |
public class GridCubes extends GridObject |
29 | 33 |
{ |
30 | 34 |
private static final float R = 0.0f;//0.2f; |
... | ... | |
740 | 744 |
// PUBLIC API |
741 | 745 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
742 | 746 |
/** |
743 |
* Creates the underlying grid of vertices, normals, texture coords and colors.
|
|
747 |
* Creates the underlying grid of vertices, normals, texture coords. |
|
744 | 748 |
* |
745 | 749 |
* @param cols Integer helping to parse the next parameter. |
746 | 750 |
* @param desc String describing the subset of a MxNx1 cuboid that we want to create. |
src/main/java/org/distorted/library/GridFlat.java | ||
---|---|---|
23 | 23 |
import java.nio.ByteOrder; |
24 | 24 |
|
25 | 25 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
26 |
|
|
26 |
/** |
|
27 |
* Create a flat, rectangular Grid. |
|
28 |
* <p> |
|
29 |
* Perfect if you just want to display a flat Texture. If you are not planning to apply any VERTEX |
|
30 |
* effects to it, use GridFlat(1,1), i.e. a Quad. Otherwise, create more vertices for more realistic effects! |
|
31 |
*/ |
|
27 | 32 |
public class GridFlat extends GridObject |
28 | 33 |
{ |
29 | 34 |
private int mCols, mRows; |
src/main/java/org/distorted/library/GridObject.java | ||
---|---|---|
24 | 24 |
import android.opengl.GLES20; |
25 | 25 |
|
26 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 |
|
|
27 |
/** |
|
28 |
* Abstract class which represents a Grid, ie 3 arrays of Vertex attributes: 1) positions |
|
29 |
* 2) normals 3) texture coordinates. |
|
30 |
* <p> |
|
31 |
* If you want to render to a particular shape, extend from here, construct the three FloatBuffers and |
|
32 |
* provide correct dataLength, i.e. the number of vertices. |
|
33 |
*/ |
|
28 | 34 |
public abstract class GridObject |
29 | 35 |
{ |
30 | 36 |
protected static final int BYTES_PER_FLOAT = 4; // |
Also available in: Unified diff
Javadoc