Revision 50642a86
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/DistortedNode.java | ||
|---|---|---|
| 54 | 54 |
{
|
| 55 | 55 |
long ID; |
| 56 | 56 |
int numPointingNodes; |
| 57 |
int numRender;
|
|
| 57 |
long currTime;
|
|
| 58 | 58 |
ArrayList<Long> key; |
| 59 | 59 |
DistortedFramebuffer mFBO; |
| 60 | 60 |
|
| ... | ... | |
| 63 | 63 |
ID = id; |
| 64 | 64 |
key = k; |
| 65 | 65 |
numPointingNodes= 1; |
| 66 |
numRender =-1;
|
|
| 66 |
currTime =-1;
|
|
| 67 | 67 |
mFBO = null; |
| 68 | 68 |
} |
| 69 | 69 |
} |
| ... | ... | |
| 197 | 197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 198 | 198 |
// return the total number of render calls issued |
| 199 | 199 |
|
| 200 |
int drawRecursive(int renderNum, long currTime, DistortedOutputSurface surface)
|
|
| 200 |
int drawRecursive(long currTime, DistortedOutputSurface surface) |
|
| 201 | 201 |
{
|
| 202 | 202 |
int ret = 0; |
| 203 | 203 |
|
| 204 |
if( mNumChildren[0]>0 && mData.numRender!=renderNum )
|
|
| 204 |
if( mNumChildren[0]>0 && mData.currTime!=currTime )
|
|
| 205 | 205 |
{
|
| 206 |
mData.numRender = renderNum;
|
|
| 206 |
mData.currTime = currTime;
|
|
| 207 | 207 |
mData.mFBO.setAsOutput(); |
| 208 | 208 |
|
| 209 | 209 |
GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| ... | ... | |
| 217 | 217 |
|
| 218 | 218 |
for(int i=0; i<mNumChildren[0]; i++) |
| 219 | 219 |
{
|
| 220 |
ret += mChildren.get(i).drawRecursive(renderNum, currTime, mData.mFBO);
|
|
| 220 |
ret += mChildren.get(i).drawRecursive(currTime, mData.mFBO); |
|
| 221 | 221 |
} |
| 222 | 222 |
} |
| 223 | 223 |
|
| src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
abstract class DistortedOutputSurface extends DistortedSurface implements DistortedAttacheable |
| 29 | 29 |
{
|
| 30 |
private static int mRender = 0; |
|
| 31 |
|
|
| 32 | 30 |
private ArrayList<DistortedNode> mChildren; |
| 33 | 31 |
private int mNumChildren; // ==mChildren.length(), but we only create mChildren if the first one gets added |
| 34 | 32 |
|
| ... | ... | |
| 115 | 113 |
*/ |
| 116 | 114 |
public int render(long time) |
| 117 | 115 |
{
|
| 118 |
mRender++; |
|
| 119 |
|
|
| 120 | 116 |
// change tree topology (attach and detach children) |
| 121 | 117 |
/* |
| 122 | 118 |
boolean changed = |
| ... | ... | |
| 154 | 150 |
|
| 155 | 151 |
for(int i=0; i<mNumChildren; i++) |
| 156 | 152 |
{
|
| 157 |
numRenders += mChildren.get(i).drawRecursive(mRender,time,this);
|
|
| 153 |
numRenders += mChildren.get(i).drawRecursive(time,this); |
|
| 158 | 154 |
} |
| 159 | 155 |
|
| 160 | 156 |
return numRenders; |
| src/main/res/raw/test_vertex_shader.glsl | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
precision lowp float; |
| 21 | 21 |
|
| 22 |
uniform vec2 u_objD; // object width X object height. |
|
| 23 |
// point (0,0) is the center of the object |
|
| 24 |
uniform mat4 u_MVPMatrix; // the combined model/view/projection matrix. |
|
| 25 |
attribute vec2 a_Position; // Per-vertex position information we will pass in. |
|
| 22 |
uniform vec2 u_objD; // object width X object height. |
|
| 23 |
uniform mat4 u_MVPMatrix; // the combined model/view/projection matrix. |
|
| 24 |
attribute vec2 a_Position; // Per-vertex position information we will pass in. |
|
| 26 | 25 |
|
| 27 | 26 |
////////////////////////////////////////////////////////////////////////////////////////////// |
| 28 | 27 |
|
Also available in: Unified diff
Simplify drawRecursive