44 |
44 |
private static final int JOB_TYPE_JOIN = 4;
|
45 |
45 |
private static final int JOB_TYPE_COPY = 5;
|
46 |
46 |
private static final int JOB_TYPE_TEXTURE = 6;
|
|
47 |
private static final int JOB_TYPE_ASSOC = 7;
|
47 |
48 |
|
48 |
49 |
private static ArrayList<JobNode> mJobs = new ArrayList<>();
|
49 |
50 |
|
... | ... | |
57 |
58 |
private EffectQueueVertex mVertexEffects;
|
58 |
59 |
private MatrixEffect mMatrixEffect;
|
59 |
60 |
private Static4D[] mMaps;
|
60 |
|
private int mAndAssoc, mEcuAssoc;
|
|
61 |
private int mComp, mAndAssoc, mEquAssoc;
|
61 |
62 |
|
62 |
|
Job(int type, MeshBase target, MeshBase[] source, VertexEffect vEff, MatrixEffect mEff, Static4D[] maps, int and, int ecu)
|
|
63 |
Job(int type, MeshBase target, MeshBase[] source, VertexEffect vEff, MatrixEffect mEff, Static4D[] maps, int comp, int and, int equ)
|
63 |
64 |
{
|
64 |
65 |
mType = type;
|
65 |
66 |
mTarget = target;
|
66 |
67 |
mSource = source;
|
67 |
68 |
mMaps = maps;
|
|
69 |
mComp = comp;
|
68 |
70 |
mAndAssoc = and;
|
69 |
|
mEcuAssoc = ecu;
|
|
71 |
mEquAssoc = equ;
|
70 |
72 |
|
71 |
73 |
if( vEff!=null )
|
72 |
74 |
{
|
... | ... | |
88 |
90 |
{
|
89 |
91 |
case JOB_TYPE_VERTEX : DistortedLibrary.adjustVertices(mTarget, mVertexEffects);
|
90 |
92 |
break;
|
91 |
|
case JOB_TYPE_MATRIX : mTarget.applyMatrix(mMatrixEffect,mAndAssoc,mEcuAssoc);
|
|
93 |
case JOB_TYPE_MATRIX : mTarget.applyMatrix(mMatrixEffect,mAndAssoc,mEquAssoc);
|
92 |
94 |
break;
|
93 |
95 |
case JOB_TYPE_MERGE_TEX: mTarget.mergeTexComponentsNow();
|
94 |
96 |
break;
|
... | ... | |
100 |
102 |
break;
|
101 |
103 |
case JOB_TYPE_TEXTURE : mTarget.textureMap(mMaps);
|
102 |
104 |
break;
|
|
105 |
case JOB_TYPE_ASSOC : mTarget.setEffectAssociationNow(mComp,mAndAssoc,mEquAssoc);
|
|
106 |
break;
|
103 |
107 |
}
|
104 |
108 |
/*
|
105 |
109 |
Log.e("jobs", "executing "+print()+" job");
|
... | ... | |
123 |
127 |
case JOB_TYPE_JOIN : return "JOIN";
|
124 |
128 |
case JOB_TYPE_COPY : return "COPY";
|
125 |
129 |
case JOB_TYPE_TEXTURE : return "TEXTURE";
|
|
130 |
case JOB_TYPE_ASSOC : return "ASSOC";
|
126 |
131 |
}
|
127 |
132 |
|
128 |
133 |
return null;
|
... | ... | |
226 |
231 |
|
227 |
232 |
if( jn==null )
|
228 |
233 |
{
|
229 |
|
Job job = new Job(JOB_TYPE_VERTEX,target,null,effect,null,null,0,0);
|
|
234 |
Job job = new Job(JOB_TYPE_VERTEX,target,null,effect,null,null,0,0,0);
|
230 |
235 |
JobNode node = new JobNode(job);
|
231 |
236 |
mJobs.add(node);
|
232 |
237 |
return node;
|
... | ... | |
240 |
245 |
}
|
241 |
246 |
else
|
242 |
247 |
{
|
243 |
|
Job job = new Job(JOB_TYPE_VERTEX,target,null,effect,null,null,0,0);
|
|
248 |
Job job = new Job(JOB_TYPE_VERTEX,target,null,effect,null,null,0,0,0);
|
244 |
249 |
JobNode node = new JobNode(job);
|
245 |
250 |
node.mPrevJobs.add(jn);
|
246 |
251 |
jn.mNextJobs.add(node);
|
... | ... | |
255 |
260 |
static JobNode matrix(MeshBase target, MatrixEffect effect, int andAssoc, int ecuAssoc)
|
256 |
261 |
{
|
257 |
262 |
JobNode jn = target.mJobNode[0];
|
258 |
|
Job job = new Job(JOB_TYPE_MATRIX,target,null,null,effect,null,andAssoc,ecuAssoc);
|
|
263 |
Job job = new Job(JOB_TYPE_MATRIX,target,null,null,effect,null,0,andAssoc,ecuAssoc);
|
259 |
264 |
JobNode node = new JobNode(job);
|
260 |
265 |
node.mPrevJobs.add(jn);
|
261 |
266 |
jn.mNextJobs.add(node);
|
... | ... | |
268 |
273 |
static JobNode mergeTex(MeshBase target)
|
269 |
274 |
{
|
270 |
275 |
JobNode jn = target.mJobNode[0];
|
271 |
|
Job job = new Job(JOB_TYPE_MERGE_TEX,target,null,null,null,null,0,0);
|
|
276 |
Job job = new Job(JOB_TYPE_MERGE_TEX,target,null,null,null,null,0,0,0);
|
272 |
277 |
JobNode node = new JobNode(job);
|
273 |
278 |
node.mPrevJobs.add(jn);
|
274 |
279 |
jn.mNextJobs.add(node);
|
... | ... | |
281 |
286 |
static JobNode mergeEff(MeshBase target)
|
282 |
287 |
{
|
283 |
288 |
JobNode jn = target.mJobNode[0];
|
284 |
|
Job job = new Job(JOB_TYPE_MERGE_EFF,target,null,null,null,null,0,0);
|
|
289 |
Job job = new Job(JOB_TYPE_MERGE_EFF,target,null,null,null,null,0,0,0);
|
285 |
290 |
JobNode node = new JobNode(job);
|
286 |
291 |
node.mPrevJobs.add(jn);
|
287 |
292 |
jn.mNextJobs.add(node);
|
... | ... | |
295 |
300 |
{
|
296 |
301 |
JobNode jn;
|
297 |
302 |
|
298 |
|
Job job = new Job(JOB_TYPE_JOIN,target,meshes,null,null,null,0,0);
|
|
303 |
Job job = new Job(JOB_TYPE_JOIN,target,meshes,null,null,null,0,0,0);
|
299 |
304 |
JobNode node = new JobNode(job);
|
300 |
305 |
|
301 |
306 |
for (MeshBase mesh : meshes)
|
... | ... | |
320 |
325 |
JobNode jn = mesh.mJobNode[0];
|
321 |
326 |
MeshBase[] meshes = new MeshBase[1];
|
322 |
327 |
meshes[0] = mesh;
|
323 |
|
Job job = new Job(JOB_TYPE_COPY,target,meshes,null,null,null,0,0);
|
|
328 |
Job job = new Job(JOB_TYPE_COPY,target,meshes,null,null,null,0,0,0);
|
324 |
329 |
JobNode node = new JobNode(job);
|
325 |
330 |
node.mPrevJobs.add(jn);
|
326 |
331 |
jn.mNextJobs.add(node);
|
... | ... | |
333 |
338 |
static JobNode textureMap(MeshBase target, Static4D[] maps)
|
334 |
339 |
{
|
335 |
340 |
JobNode jn = target.mJobNode[0];
|
336 |
|
Job job = new Job(JOB_TYPE_TEXTURE,target,null,null,null,maps,0,0);
|
|
341 |
Job job = new Job(JOB_TYPE_TEXTURE,target,null,null,null,maps,0,0,0);
|
|
342 |
JobNode node = new JobNode(job);
|
|
343 |
node.mPrevJobs.add(jn);
|
|
344 |
jn.mNextJobs.add(node);
|
|
345 |
mJobs.add(node);
|
|
346 |
return node;
|
|
347 |
}
|
|
348 |
|
|
349 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
350 |
|
|
351 |
static JobNode effectAssoc(MeshBase target, int comp, int andAssoc, int equAssoc)
|
|
352 |
{
|
|
353 |
JobNode jn = target.mJobNode[0];
|
|
354 |
Job job = new Job(JOB_TYPE_ASSOC,target,null,null,null,null,comp,andAssoc,equAssoc);
|
337 |
355 |
JobNode node = new JobNode(job);
|
338 |
356 |
node.mPrevJobs.add(jn);
|
339 |
357 |
jn.mNextJobs.add(node);
|
Library: make setEffectAssociation a deferred job (because we do copy the uniforms during join!)
SingleMesh App: almost finished.