Project

General

Profile

« Previous | Next » 

Revision 432442f9

Added by Leszek Koltunski over 7 years ago

New DistortedProgram class.

View differences:

src/main/java/org/distorted/library/DistortedEffects.java
294 294

  
295 295
    return false;
296 296
    }
297
   
297

  
298
///////////////////////////////////////////////////////////////////////////////////////////////////
299
/**
300
 * Returns the maximum number of Matrix effects.
301
 *
302
 * @return The maximum number of Matrix effects
303
 */
304
  public static int getMaxMatrix()
305
    {
306
    return EffectQueue.getMax(EffectTypes.MATRIX.ordinal());
307
    }
308

  
309
///////////////////////////////////////////////////////////////////////////////////////////////////
310
/**
311
 * Returns the maximum number of Vertex effects.
312
 *
313
 * @return The maximum number of Vertex effects
314
 */
315
  public static int getMaxVertex()
316
    {
317
    return EffectQueue.getMax(EffectTypes.VERTEX.ordinal());
318
    }
319

  
320
///////////////////////////////////////////////////////////////////////////////////////////////////
321
/**
322
 * Returns the maximum number of Fragment effects.
323
 *
324
 * @return The maximum number of Fragment effects
325
 */
326
  public static int getMaxFragment()
327
    {
328
    return EffectQueue.getMax(EffectTypes.FRAGMENT.ordinal());
329
    }
330

  
331
///////////////////////////////////////////////////////////////////////////////////////////////////
332
/**
333
 * Returns the maximum number of Postprocess effects.
334
 *
335
 * @return The maximum number of Postprocess effects
336
 */
337
  public static int getMaxPostprocess()
338
    {
339
    return EffectQueue.getMax(EffectTypes.POSTPROCESS.ordinal());
340
    }
341

  
342
///////////////////////////////////////////////////////////////////////////////////////////////////
343
/**
344
 * Sets the maximum number of Matrix effects that can be stored in a single EffectQueue at one time.
345
 * This can fail if:
346
 * <ul>
347
 * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
348
 * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
349
 *     before the Vertex Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
350
 *     time only decreasing the value of 'max' is permitted.
351
 * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
352
 * </ul>
353
 *
354
 * @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater
355
 *            than Byte.MAX_VALUE
356
 * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
357
 */
358
  public static boolean setMaxMatrix(int max)
359
    {
360
    return EffectQueue.setMax(EffectTypes.MATRIX.ordinal(),max);
361
    }
362

  
363
///////////////////////////////////////////////////////////////////////////////////////////////////
364
/**
365
 * Sets the maximum number of Vertex effects that can be stored in a single EffectQueue at one time.
366
 * This can fail if:
367
 * <ul>
368
 * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
369
 * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
370
 *     before the Vertex Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
371
 *     time only decreasing the value of 'max' is permitted.
372
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
373
 * </ul>
374
 *
375
 * @param max new maximum number of simultaneous Vertex Effects. Has to be a non-negative number not greater
376
 *            than Byte.MAX_VALUE
377
 * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
378
 */
379
  public static boolean setMaxVertex(int max)
380
    {
381
    return EffectQueue.setMax(EffectTypes.VERTEX.ordinal(),max);
382
    }
383

  
384
///////////////////////////////////////////////////////////////////////////////////////////////////
385
/**
386
 * Sets the maximum number of Fragment effects that can be stored in a single EffectQueue at one time.
387
 * This can fail if:
388
 * <ul>
389
 * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
390
 * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
391
 *     before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
392
 *     time only decreasing the value of 'max' is permitted.
393
 * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
394
 * </ul>
395
 *
396
 * @param max new maximum number of simultaneous Fragment Effects. Has to be a non-negative number not greater
397
 *            than Byte.MAX_VALUE
398
 * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
399
 */
400
  public static boolean setMaxFragment(int max)
401
    {
402
    return EffectQueue.setMax(EffectTypes.FRAGMENT.ordinal(),max);
403
    }
404

  
405
///////////////////////////////////////////////////////////////////////////////////////////////////
406
/**
407
 * Sets the maximum number of Postprocess effects that can be stored in a single EffectQueue at one time.
408
 * This can fail if:
409
 * <ul>
410
 * <li>the value of 'max' is outside permitted range (0 &le; max &le; Byte.MAX_VALUE)
411
 * <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called
412
 *     before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this
413
 *     time only decreasing the value of 'max' is permitted.
414
 * <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created.
415
 * </ul>
416
 *
417
 * @param max new maximum number of simultaneous Postprocess Effects. Has to be a non-negative number not greater
418
 *            than Byte.MAX_VALUE
419
 * @return <code>true</code> if operation was successful, <code>false</code> otherwise.
420
 */
421
  public static boolean setMaxPostprocess(int max)
422
    {
423
    return EffectQueue.setMax(EffectTypes.POSTPROCESS.ordinal(),max);
424
    }
425

  
298 426
///////////////////////////////////////////////////////////////////////////////////////////////////   
299 427
///////////////////////////////////////////////////////////////////////////////////////////////////
300 428
// Individual effect functions.

Also available in: Unified diff