Revision c90aca24
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
36 | 36 |
private long mID; |
37 | 37 |
private EffectQueue[] mQueues; |
38 | 38 |
|
39 |
private int[] mStretchX, mStretchY, mStretchZ; |
|
40 |
|
|
39 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 42 |
/** |
41 | 43 |
* @y.exclude |
... | ... | |
58 | 60 |
/** |
59 | 61 |
* Create empty effect queue. |
60 | 62 |
*/ |
61 |
public DistortedEffects() |
|
63 |
public DistortedEffects(int stretchX, int stretchY, int stretchZ) |
|
64 |
{ |
|
65 |
mStretchX = new int[1]; |
|
66 |
mStretchY = new int[1]; |
|
67 |
mStretchZ = new int[1]; |
|
68 |
|
|
69 |
mStretchX[0] = stretchX; |
|
70 |
mStretchY[0] = stretchY; |
|
71 |
mStretchZ[0] = stretchZ; |
|
72 |
|
|
73 |
mID = ++mNextID; |
|
74 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
|
75 |
EffectQueue.allocateQueues(mQueues,null,0); |
|
76 |
} |
|
77 |
|
|
78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
79 |
/** |
|
80 |
* Temporary constructor. |
|
81 |
*/ |
|
82 |
public DistortedEffects(int dummy) |
|
62 | 83 |
{ |
84 |
mStretchX = new int[1]; |
|
85 |
mStretchY = new int[1]; |
|
86 |
mStretchZ = new int[1]; |
|
87 |
|
|
88 |
mStretchX[0] = 1; |
|
89 |
mStretchY[0] = 1; |
|
90 |
mStretchZ[0] = 1; |
|
91 |
|
|
63 | 92 |
mID = ++mNextID; |
64 | 93 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
65 | 94 |
EffectQueue.allocateQueues(mQueues,null,0); |
... | ... | |
77 | 106 |
*/ |
78 | 107 |
public DistortedEffects(DistortedEffects dc, int flags) |
79 | 108 |
{ |
109 |
mStretchX = dc.mStretchX; |
|
110 |
mStretchY = dc.mStretchY; |
|
111 |
mStretchZ = dc.mStretchZ; |
|
112 |
|
|
80 | 113 |
mID = ++mNextID; |
81 | 114 |
mQueues = new EffectQueue[EffectType.LENGTH]; |
82 | 115 |
EffectQueue.allocateQueues(mQueues,dc.getQueues(),flags); |
83 | 116 |
} |
84 | 117 |
|
118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
119 |
/** |
|
120 |
* Sets the stretch parameters. Coordinates of all vertices of any Mesh rendered with those Effects |
|
121 |
* will be first pre-multiplied by those. |
|
122 |
*/ |
|
123 |
public void setStretch(int sx, int sy, int sz) |
|
124 |
{ |
|
125 |
mStretchX[0] = sx; |
|
126 |
mStretchY[0] = sy; |
|
127 |
mStretchZ[0] = sz; |
|
128 |
} |
|
129 |
|
|
130 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
131 |
/** |
|
132 |
* X coordinates of all vertices of any Mesh rendered with those Effects will be first pre-multiplied |
|
133 |
* by this parameter. |
|
134 |
*/ |
|
135 |
public int getStartchX() |
|
136 |
{ |
|
137 |
return mStretchX[0]; |
|
138 |
} |
|
139 |
|
|
140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
141 |
/** |
|
142 |
* Y coordinates of all vertices of any Mesh rendered with those Effects will be first pre-multiplied |
|
143 |
* by this parameter. |
|
144 |
*/ |
|
145 |
public int getStartchY() |
|
146 |
{ |
|
147 |
return mStretchY[0]; |
|
148 |
} |
|
149 |
|
|
150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
151 |
/** |
|
152 |
* Z coordinates of all vertices of any Mesh rendered with those Effects will be first pre-multiplied |
|
153 |
* by this parameter. |
|
154 |
*/ |
|
155 |
public int getStartchZ() |
|
156 |
{ |
|
157 |
return mStretchZ[0]; |
|
158 |
} |
|
159 |
|
|
85 | 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
86 | 161 |
/** |
87 | 162 |
* Returns unique ID of this instance. |
Also available in: Unified diff
Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)