am f4cca783: Merge change 23583 into eclair
Merge commit 'f4cca783dff5335108647ff7ae86983f56245067' into eclair-plus-aosp * commit 'f4cca783dff5335108647ff7ae86983f56245067': Update fountain to use structures.
This commit is contained in:
@@ -4,45 +4,44 @@
|
||||
#pragma stateFragment(default)
|
||||
#pragma stateFragmentStore(default)
|
||||
|
||||
struct PartStruct {float dx; float dy; float x; float y; int c;};
|
||||
int newPart = 0;
|
||||
|
||||
int main(int launchID) {
|
||||
int ct;
|
||||
int count = Control_count - 1;
|
||||
int rate = Control_rate;
|
||||
float *dataF = loadArrayF(1, 0);
|
||||
float height = getHeight();
|
||||
struct PartStruct * p = (struct PartStruct *)loadArrayF(1, 0);
|
||||
|
||||
if (rate) {
|
||||
int *dataI = loadArrayI32(1, 0);
|
||||
float rMax = ((float)rate) * 0.005f;
|
||||
int x = Control_x;
|
||||
int y = Control_y;
|
||||
int newPart = loadI32(1, count * 5);
|
||||
int c = colorFloatRGBAtoUNorm8(Control_r, Control_g, Control_b, 0.99f);
|
||||
|
||||
while (rate--) {
|
||||
int idx = newPart * 5;
|
||||
vec2Rand(dataF + idx, rMax);
|
||||
dataF[idx + 2] = x;
|
||||
dataF[idx + 3] = y;
|
||||
dataI[idx + 4] = c;
|
||||
vec2Rand((float *)(p + newPart), rMax);
|
||||
p[newPart].x = x;
|
||||
p[newPart].y = y;
|
||||
p[newPart].c = c;
|
||||
newPart++;
|
||||
if (newPart >= count) {
|
||||
newPart = 0;
|
||||
}
|
||||
}
|
||||
storeI32(1, count * 5, newPart);
|
||||
}
|
||||
|
||||
for (ct=0; ct < count; ct++) {
|
||||
float dy = dataF[1] + 0.15f;
|
||||
float posy = dataF[3] + dy;
|
||||
float dy = p->dy + 0.15f;
|
||||
float posy = p->y + dy;
|
||||
if ((posy > height) && (dy > 0)) {
|
||||
dy *= -0.3f;
|
||||
}
|
||||
dataF[1] = dy;
|
||||
dataF[2] += dataF[0];
|
||||
dataF[3] = posy;
|
||||
dataF += 5;
|
||||
p->dy = dy;
|
||||
p->x += p->dx;
|
||||
p->y = posy;
|
||||
p++;
|
||||
}
|
||||
|
||||
uploadToBufferObject(NAMED_PartBuffer);
|
||||
|
||||
Reference in New Issue
Block a user