Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 |
// FRAGMENT EFFECTS
|
|
24 |
|
|
25 |
|
|
23 |
/**
|
|
24 |
* Fragment Effect - an Effect that works by injecting certain code into the main Fragment shader. |
|
25 |
*/ |
|
26 | 26 |
public abstract class FragmentEffect extends Effect |
27 | 27 |
{ |
28 |
public static final int NUM_UNIFORMS = 8; // 4-per effect interpolated values, 4 dimensional Region. |
|
28 |
/** |
|
29 |
* 8: 4-per effect interpolated values, 4 dimensional Region. |
|
30 |
*/ |
|
31 |
public static final int NUM_UNIFORMS = 8; |
|
29 | 32 |
private static String mGLSL = ""; |
30 | 33 |
private static int mNumEnabled = 0; |
31 | 34 |
|
... | ... | |
37 | 40 |
} |
38 | 41 |
|
39 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 |
// prepare code to be injected into the 'main_fragment_shader' main() function. |
|
40 | 44 |
|
41 | 45 |
static void addEffect(EffectName not_smooth, EffectName yes_smooth, String code) |
42 | 46 |
{ |
... | ... | |
64 | 68 |
} |
65 | 69 |
|
66 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
67 |
|
|
71 |
/** |
|
72 |
* Only for use by the library itself. |
|
73 |
* |
|
74 |
* @y.exclude |
|
75 |
*/ |
|
68 | 76 |
public static String getGLSL() |
69 | 77 |
{ |
70 | 78 |
return mGLSL + "{}"; |
71 | 79 |
} |
72 | 80 |
|
73 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
74 |
|
|
75 |
public static int getNumEnabled() |
|
82 |
/** |
|
83 |
* Only for use by the library itself. |
|
84 |
* |
|
85 |
* @y.exclude |
|
86 |
*/ |
|
87 |
public static void onDestroy() |
|
76 | 88 |
{ |
77 |
return mNumEnabled; |
|
89 |
mNumEnabled = 0; |
|
90 |
mGLSL = ""; |
|
78 | 91 |
} |
79 | 92 |
|
80 | 93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
81 |
|
|
82 |
public static void onDestroy() |
|
94 |
// PUBLIC API |
|
95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
96 |
/** |
|
97 |
* Return the number of Fragment effects enabled. |
|
98 |
*/ |
|
99 |
public static int getNumEnabled() |
|
83 | 100 |
{ |
84 |
mNumEnabled = 0; |
|
85 |
mGLSL = ""; |
|
101 |
return mNumEnabled; |
|
86 | 102 |
} |
87 | 103 |
} |
Also available in: Unified diff
Javadoc.