Revision 6923706f
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/library/mesh/DeferredJobs.java | ||
---|---|---|
195 | 195 |
static JobNode merge(MeshBase target) |
196 | 196 |
{ |
197 | 197 |
JobNode jn = target.mJobNode[0]; |
198 |
|
|
199 |
if( jn==null ) |
|
200 |
{ |
|
201 |
android.util.Log.e("deferredJobs", "Error: trying to add a merge job to an empty graph!"); |
|
202 |
return jn; |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
if( jn.mJob.mType==JOB_TYPE_MERGE ) |
|
207 |
{ |
|
208 |
android.util.Log.e("deferredJobs", "Error: trying to add a second consecutive merge job"); |
|
209 |
return jn; |
|
210 |
} |
|
211 |
else |
|
212 |
{ |
|
213 |
Job job = new Job(JOB_TYPE_MERGE,target,null,null,0); |
|
214 |
JobNode node = new JobNode(job); |
|
215 |
node.mPrevJobs.add(jn); |
|
216 |
jn.mNextJobs.add(node); |
|
217 |
mJobs.add(node); |
|
218 |
return node; |
|
219 |
} |
|
220 |
} |
|
198 |
Job job = new Job(JOB_TYPE_MERGE,target,null,null,0); |
|
199 |
JobNode node = new JobNode(job); |
|
200 |
node.mPrevJobs.add(jn); |
|
201 |
jn.mNextJobs.add(node); |
|
202 |
mJobs.add(node); |
|
203 |
return node; |
|
221 | 204 |
} |
222 | 205 |
|
223 | 206 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
224 | 207 |
|
225 | 208 |
static JobNode join(MeshBase target, MeshBase[] meshes, int origVertices) |
226 | 209 |
{ |
227 |
JobNode jn = target.mJobNode[0];
|
|
210 |
JobNode jn; |
|
228 | 211 |
|
229 |
if( jn==null ) |
|
230 |
{ |
|
231 |
android.util.Log.e("deferredJobs", "Error: trying to add a join job to an empty graph!"); |
|
232 |
return jn; |
|
233 |
} |
|
234 |
else |
|
212 |
Job job = new Job(JOB_TYPE_JOIN,target,meshes,null,origVertices); |
|
213 |
JobNode node = new JobNode(job); |
|
214 |
|
|
215 |
for (MeshBase mesh : meshes) |
|
235 | 216 |
{ |
236 |
if( jn.mJob.mType==JOB_TYPE_JOIN ) |
|
237 |
{ |
|
238 |
android.util.Log.e("deferredJobs", "Error: trying to add a second consecutive join job"); |
|
239 |
return jn; |
|
240 |
} |
|
241 |
else |
|
242 |
{ |
|
243 |
Job job = new Job(JOB_TYPE_JOIN,target,meshes,null,origVertices); |
|
244 |
JobNode node = new JobNode(job); |
|
245 |
node.mPrevJobs.add(jn); |
|
246 |
jn.mNextJobs.add(node); |
|
247 |
mJobs.add(node); |
|
248 |
return node; |
|
249 |
} |
|
217 |
jn = mesh.mJobNode[0]; |
|
218 |
node.mPrevJobs.add(jn); |
|
219 |
jn.mNextJobs.add(node); |
|
250 | 220 |
} |
221 |
|
|
222 |
mJobs.add(node); |
|
223 |
return node; |
|
251 | 224 |
} |
252 | 225 |
|
253 | 226 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
254 | 227 |
|
255 | 228 |
static JobNode copy(MeshBase target, MeshBase mesh) |
256 | 229 |
{ |
257 |
JobNode jn = target.mJobNode[0]; |
|
258 |
|
|
259 |
if( jn==null ) |
|
260 |
{ |
|
261 |
android.util.Log.e("deferredJobs", "Error: trying to add a copy job to an empty graph!"); |
|
262 |
return jn; |
|
263 |
} |
|
264 |
else |
|
265 |
{ |
|
266 |
if( jn.mJob.mType==JOB_TYPE_COPY ) |
|
267 |
{ |
|
268 |
android.util.Log.e("deferredJobs", "Error: trying to add a second consecutive copy job"); |
|
269 |
return jn; |
|
270 |
} |
|
271 |
else |
|
272 |
{ |
|
273 |
MeshBase[] meshes = new MeshBase[1]; |
|
274 |
meshes[0] = mesh; |
|
275 |
Job job = new Job(JOB_TYPE_COPY,target,meshes,null,0); |
|
276 |
JobNode node = new JobNode(job); |
|
277 |
node.mPrevJobs.add(jn); |
|
278 |
jn.mNextJobs.add(node); |
|
279 |
mJobs.add(node); |
|
280 |
return node; |
|
281 |
} |
|
282 |
} |
|
230 |
JobNode jn = mesh.mJobNode[0]; |
|
231 |
MeshBase[] meshes = new MeshBase[1]; |
|
232 |
meshes[0] = mesh; |
|
233 |
Job job = new Job(JOB_TYPE_COPY,target,meshes,null,0); |
|
234 |
JobNode node = new JobNode(job); |
|
235 |
node.mPrevJobs.add(jn); |
|
236 |
jn.mNextJobs.add(node); |
|
237 |
mJobs.add(node); |
|
238 |
return node; |
|
283 | 239 |
} |
284 | 240 |
|
285 | 241 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with DeferredJobs app/lib (still does not work though)