Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a43e7613 authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Fountain example cleanup. Remove compatability versions of rsg...

Merge "Fountain example cleanup. Remove compatability versions of rsg functions that took old 'i' types."
parents 57f4e5bc 94d07599
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

static int newPart = 0;

float4 partColor;
static float4 partColor;
rs_mesh partMesh;

typedef struct __attribute__((packed, aligned(4))) Point {
@@ -44,22 +44,18 @@ int root() {

#pragma rs export_func(addParticles)

void addParticles(int rate, int x, int y)
void addParticles(int rate, float x, float y, int newColor)
{
    //rsDebug("partColor", partColor);
    //rsDebug("partColor x", partColor.x);
    //rsDebug("partColor y", partColor.y);
    //rsDebug("partColor z", partColor.z);
    //rsDebug("partColor w", partColor.w);

    if (newColor) {
        partColor.x = rsRand(0.5f, 1.0f);
        partColor.y = rsRand(1.0f);
        partColor.z = rsRand(1.0f);
    }
    float rMax = ((float)rate) * 0.005f;
    int size = rsAllocationGetDimX(rsGetAllocation(point));
    uchar4 c = rsPackColorTo8888(partColor);

    uchar4 c = rsPackColorTo8888(partColor.x, partColor.y, partColor.z);

    //rsDebug("color ", ((int *)&c)[0]);
    Point_t * np = &point[newPart];

    float2 p = {x, y};
    while (rate--) {
        float angle = rsRand(3.14f * 2.f);
+1 −9
Original line number Diff line number Diff line
@@ -48,18 +48,10 @@ public class FountainRS {
        mRS.contextBindRootScript(mScript);
    }

    Float4 tmpColor = new Float4();
    boolean holdingColor = false;
    java.util.Random mRand = new java.util.Random();
    public void newTouchPosition(int x, int y, int rate) {
        if (rate > 0) {
            if (!holdingColor) {
                tmpColor.x = mRand.nextFloat() * 0.5f + 0.5f;
                tmpColor.y = mRand.nextFloat();
                tmpColor.z = mRand.nextFloat();
                mScript.set_partColor(tmpColor);
            }
            mScript.invoke_addParticles(rate, x, y);
            mScript.invoke_addParticles(rate, x, y, !holdingColor ? 1 : 0);
            holdingColor = true;
        } else {
            holdingColor = false;
+5 −4
Original line number Diff line number Diff line
@@ -63,11 +63,12 @@ public class ScriptC_Fountain extends ScriptC {
    }

    private final static int mExportFuncIdx_addParticles = 0;
    public void invoke_addParticles(int rate, int x, int y) {
        FieldPacker addParticles_fp = new FieldPacker(12);
    public void invoke_addParticles(int rate, float x, float y, int newColor) {
        FieldPacker addParticles_fp = new FieldPacker(16);
        addParticles_fp.addI32(rate);
        addParticles_fp.addI32(x);
        addParticles_fp.addI32(y);
        addParticles_fp.addF32(x);
        addParticles_fp.addF32(y);
        addParticles_fp.addI32(newColor);
        invoke(mExportFuncIdx_addParticles, addParticles_fp);
    }

+0 −5
Original line number Diff line number Diff line
@@ -345,8 +345,6 @@ static ScriptCState::SymbolTable_t gSyms[] = {
    { "rsgGetWidth", (void *)&SC_getWidth },
    { "rsgGetHeight", (void *)&SC_getHeight },

  { "_Z18rsgUploadToTextureii", (void *)&SC_uploadToTexture2 },
  { "_Z18rsgUploadToTexturei", (void *)&SC_uploadToTexture },
    { "_Z18rsgUploadToTexture13rs_allocationi", (void *)&SC_uploadToTexture2 },
    { "_Z18rsgUploadToTexture13rs_allocation", (void *)&SC_uploadToTexture },
    { "rsgUploadToBufferObject", (void *)&SC_uploadToBufferObject },
@@ -358,8 +356,6 @@ static ScriptCState::SymbolTable_t gSyms[] = {
    { "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace },
    { "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh },
    { "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange },
  { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh },
  { "_Z17rsgDrawSimpleMeshiii", (void *)&SC_drawSimpleMeshRange },

    { "rsgClearColor", (void *)&SC_ClearColor },
    { "rsgClearDepth", (void *)&SC_ClearDepth },
@@ -370,7 +366,6 @@ static ScriptCState::SymbolTable_t gSyms[] = {
    { "updateSimpleMesh", (void *)&SC_updateSimpleMesh },

    // misc
    //{ "pfClearColor", (void *)&SC_ClearColor },
    { "color", (void *)&SC_color },

    { NULL, NULL }