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

Commit 7df07026 authored by Jason Sams's avatar Jason Sams
Browse files

Remove shadows and invert dx sign in zoomed mode.

parent c1ea948e
Loading
Loading
Loading
Loading
+0 −33
Original line number Original line Diff line number Diff line
@@ -32,7 +32,6 @@ int main(void* con, int ft, int launchID)
    int col;
    int col;
    int imageID;
    int imageID;
    int iconCount;
    int iconCount;
    int pressure;


    float f = loadF(2, 0);
    float f = loadF(2, 0);
    pfClearColor(0.0f, 0.0f, 0.0f, f);
    pfClearColor(0.0f, 0.0f, 0.0f, f);
@@ -57,48 +56,16 @@ int main(void* con, int ft, int launchID)
    float diam = 8.f;// + curve * 2.f;
    float diam = 8.f;// + curve * 2.f;
    float scale = 1.0f / zoom;
    float scale = 1.0f / zoom;


    pressure = loadI32(0, STATE_PRESSURE);
    if (pressure) {
        contextBindProgramFragmentStore(NAMED_PFSShadow);

        // compute the projected shadow
        float x = loadI32(0, STATE_POS_X) / 1000.f;
        float y = loadI32(0, STATE_POS_Y) / 1000.f;
        float s = loadI32(0, STATE_PRESSURE) / 1000.f;

        s = s * 3.f;

        float dxdy1 = (x - 0.5f - s) / (1.001f - y);
        float dxdy2 = (x - 0.5f + s) / (1.001f - y);

        float xlt = y * dxdy1 + x;
        float xrt = y * dxdy2 + x;

        float yb = (0.5f - y) * 5.f + 0.2f;

        drawQuad(xlt, 5.f, 1,
                 xrt, 5.f, 1,
                 x + s, yb, 1,
                 x - s, yb, 1);

        contextBindProgramFragmentStore(NAMED_PFS);
    }


    rot = rot * scale;
    rot = rot * scale;
    float rotStep = 20.0f / 180.0f * 3.14f * scale;
    float rotStep = 20.0f / 180.0f * 3.14f * scale;
    //pressure = loadI32(0, 2);
    rowCount = 4;
    rowCount = 4;
    iconCount = 32;//loadI32(0, 1);
    iconCount = 32;//loadI32(0, 1);
    while (iconCount) {
    while (iconCount) {
        float tmpSin = sinf(rot);
        float tmpSin = sinf(rot);
        float tmpCos = cosf(rot);
        float tmpCos = cosf(rot);


        //tmpCos = tmpCos * curve;

        float tx1 = tmpSin * diam - (tmpCos * scale);
        float tx1 = tmpSin * diam - (tmpCos * scale);
        float tx2 = tx1 + (tmpCos * scale * 2.f);
        float tx2 = tx1 + (tmpCos * scale * 2.f);

        float tz1 = tmpCos * diam + (tmpSin * scale);
        float tz1 = tmpCos * diam + (tmpSin * scale);
        float tz2 = tz1 - (tmpSin * scale * 2.f);
        float tz2 = tz1 - (tmpSin * scale * 2.f);


+0 −23
Original line number Original line Diff line number Diff line
@@ -70,18 +70,6 @@ public class RolloRS {
        mAllocState.data(mAllocStateBuf);
        mAllocState.data(mAllocStateBuf);
    }
    }


    public void setShadow(float x, float y, float size) {
        // x and y are normalized at this point.
        mAllocStateBuf[STATE_POS_X] = (int)(x * 1000);
        mAllocStateBuf[STATE_POS_Y] = (int)(y * 1000);
        mAllocStateBuf[STATE_PRESSURE] = (int)(size * 1000);

        //Log.e("rs","shadow x=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              //"  y=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              //"  s=" + Integer.toString(mAllocStateBuf[STATE_PRESSURE]));
        mAllocState.data(mAllocStateBuf);
    }

    public void setZoom(float z) {
    public void setZoom(float z) {
        //Log.e("rs", "zoom " + Float.toString(z));
        //Log.e("rs", "zoom " + Float.toString(z));


@@ -104,7 +92,6 @@ public class RolloRS {


    private RenderScript.Sampler mSampler;
    private RenderScript.Sampler mSampler;
    private RenderScript.ProgramFragmentStore mPFSBackground;
    private RenderScript.ProgramFragmentStore mPFSBackground;
    private RenderScript.ProgramFragmentStore mPFSShadow;
    private RenderScript.ProgramFragment mPFBackground;
    private RenderScript.ProgramFragment mPFBackground;
    private RenderScript.ProgramFragment mPFImages;
    private RenderScript.ProgramFragment mPFImages;
    private RenderScript.ProgramVertex mPV;
    private RenderScript.ProgramVertex mPV;
@@ -153,16 +140,6 @@ public class RolloRS {
        mPFSBackground = mRS.programFragmentStoreCreate();
        mPFSBackground = mRS.programFragmentStoreCreate();
        mPFSBackground.setName("PFS");
        mPFSBackground.setName("PFS");


        mRS.programFragmentStoreBegin(null, null);
        mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
        mRS.programFragmentStoreDitherEnable(false);
        mRS.programFragmentStoreDepthMask(true);
        mRS.programFragmentStoreColorMask(false, false, false, false);
        mPFSShadow = mRS.programFragmentStoreCreate();
        mPFSShadow.setName("PFSShadow");



        mPVAlloc = new ProgramVertexAlloc(mRS);
        mPVAlloc = new ProgramVertexAlloc(mRS);
        mRS.programVertexBegin(null, null);
        mRS.programVertexBegin(null, null);
        mRS.programVertexSetTextureMatrixEnable(true);
        mRS.programVertexSetTextureMatrixEnable(true);
+1 −4
Original line number Original line Diff line number Diff line
@@ -90,7 +90,6 @@ public class RolloView extends RSSurfaceView {
        mRender.setTouch(ret);
        mRender.setTouch(ret);


        if((ny > 0.85f) || mControlMode) {
        if((ny > 0.85f) || mControlMode) {
            mRender.setShadow(0, 0, 0);
            mFlingMode = false;
            mFlingMode = false;


            // Projector control
            // Projector control
@@ -107,7 +106,7 @@ public class RolloView extends RSSurfaceView {
                                mControlMode = false;
                                mControlMode = false;
                            }
                            }
                        }
                        }
                        mColumn += dx * 3;// * zoom;
                        mColumn += -dx * 2.3;// * zoom;
                        mColumn += -(mZoom - zoom) * (nx - 0.5f) * 2 * zoom;
                        mColumn += -(mZoom - zoom) * (nx - 0.5f) * 2 * zoom;
                        mZoom = zoom;
                        mZoom = zoom;


@@ -155,10 +154,8 @@ public class RolloView extends RSSurfaceView {
                mFlingMode = true;
                mFlingMode = true;
                mFlingX = nx;
                mFlingX = nx;
                mFlingY = ny;
                mFlingY = ny;
                //mRender.setShadow(nx, ny, ev.getSize());
            } else {
            } else {
                mFlingMode = false;
                mFlingMode = false;
                mRender.setShadow(nx, ny, 0);
            }
            }
        }
        }