Revision e5f796bc
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/library/effect/VertexEffect.java | ||
---|---|---|
21 | 21 |
package org.distorted.library.effect; |
22 | 22 |
|
23 | 23 |
import org.distorted.library.effectqueue.EffectQueue; |
24 |
import org.distorted.library.type.Static1D; |
|
25 |
import org.distorted.library.type.Static3D; |
|
24 | 26 |
import org.distorted.library.type.Static4D; |
27 |
import org.distorted.library.type.Static5D; |
|
25 | 28 |
|
26 | 29 |
import java.lang.reflect.Method; |
27 | 30 |
import java.util.ArrayList; |
... | ... | |
253 | 256 |
queue.setAssociation(id); |
254 | 257 |
} |
255 | 258 |
} |
259 |
|
|
260 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
261 |
/** |
|
262 |
* Return a constructed VertexEffect based on its name, the 5 variables, center & region. |
|
263 |
*/ |
|
264 |
public static VertexEffect constructEffect(String name,float[] vars, float[] center, float[] region) |
|
265 |
{ |
|
266 |
Static3D staCenter = new Static3D(center[0],center[1],center[2]); |
|
267 |
Static4D staRegion = new Static4D(region[0],region[1],region[2],region[3]); |
|
268 |
|
|
269 |
if( name.equals(EffectName.DISTORT.name()) ) |
|
270 |
{ |
|
271 |
Static3D staVars = new Static3D(vars[2],vars[3],vars[4]); |
|
272 |
return new VertexEffectDistort(staVars,staCenter,staRegion); |
|
273 |
} |
|
274 |
if( name.equals(EffectName.DEFORM.name()) ) |
|
275 |
{ |
|
276 |
Static3D staVars = new Static3D(vars[1],vars[2],vars[3]); |
|
277 |
Static1D staRadius = new Static1D(vars[4]); |
|
278 |
return new VertexEffectDeform(staVars,staRadius,staCenter,staRegion); |
|
279 |
} |
|
280 |
if( name.equals(EffectName.SINK.name()) ) |
|
281 |
{ |
|
282 |
Static1D staSink = new Static1D(vars[4]); |
|
283 |
return new VertexEffectSink(staSink,staCenter,staRegion); |
|
284 |
} |
|
285 |
if( name.equals(EffectName.PINCH.name()) ) |
|
286 |
{ |
|
287 |
Static3D staVars = new Static3D(vars[2],vars[3],vars[4]); |
|
288 |
return new VertexEffectPinch(staVars,staCenter,staRegion); |
|
289 |
} |
|
290 |
if( name.equals(EffectName.SWIRL.name()) ) |
|
291 |
{ |
|
292 |
Static1D staSwirl = new Static1D(vars[4]); |
|
293 |
return new VertexEffectSwirl(staSwirl,staCenter,staRegion); |
|
294 |
} |
|
295 |
if( name.equals(EffectName.WAVE.name()) ) |
|
296 |
{ |
|
297 |
Static5D staWave = new Static5D(vars[0],vars[1],vars[2],vars[3],vars[4]); |
|
298 |
return new VertexEffectWave(staWave,staCenter,staRegion); |
|
299 |
} |
|
300 |
if( name.equals(EffectName.DISAPPEAR.name()) ) |
|
301 |
{ |
|
302 |
return new VertexEffectDisappear(); |
|
303 |
} |
|
304 |
if( name.equals(EffectName.VERTEX_MOVE.name()) ) |
|
305 |
{ |
|
306 |
Static3D staVector = new Static3D(vars[2],vars[3],vars[4]); |
|
307 |
return new VertexEffectMove(staVector); |
|
308 |
} |
|
309 |
if( name.equals(EffectName.VERTEX_QUATERNION.name()) ) |
|
310 |
{ |
|
311 |
Static4D staQuat = new Static4D(vars[1],vars[2],vars[3],vars[4]); |
|
312 |
return new VertexEffectQuaternion(staQuat,staCenter); |
|
313 |
} |
|
314 |
if( name.equals(EffectName.VERTEX_ROTATE.name()) ) |
|
315 |
{ |
|
316 |
Static1D staAngle = new Static1D(vars[1]); |
|
317 |
Static3D staAxis = new Static3D(vars[2],vars[3],vars[4]); |
|
318 |
return new VertexEffectRotate(staAngle,staAxis,staCenter); |
|
319 |
} |
|
320 |
if( name.equals(EffectName.VERTEX_SCALE.name()) ) |
|
321 |
{ |
|
322 |
Static3D staScale = new Static3D(vars[2],vars[3],vars[4]); |
|
323 |
return new VertexEffectScale(staScale); |
|
324 |
} |
|
325 |
if( name.equals(EffectName.VERTEX_SHEAR.name()) ) |
|
326 |
{ |
|
327 |
Static3D staShear = new Static3D(vars[2],vars[3],vars[4]); |
|
328 |
return new VertexEffectShear(staShear,staCenter); |
|
329 |
} |
|
330 |
|
|
331 |
return null; |
|
332 |
} |
|
256 | 333 |
} |
Also available in: Unified diff
Major change in JSOn file format:
replace the old (corners,centers) system with a list of VertexEffects which are applied to each cubit variant.