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

Commit c97bb884 authored by Jason Sams's avatar Jason Sams
Browse files

Split rsScriptC into class implemtation and library functions. Update test...

Split rsScriptC into class implemtation and library functions.  Update test apps, all 3 should be working.
parent e6c8e9b8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ LOCAL_SRC_FILES:= \
	rsSampler.cpp \
	rsScript.cpp \
	rsScriptC.cpp \
	rsScriptC_Lib.cpp \
	rsThreadIO.cpp \
	rsType.cpp \
	rsTriangleMesh.cpp
+1 −59
Original line number Diff line number Diff line
@@ -30,65 +30,7 @@ typedef struct {
#define RS_PROGRAM_VERTEX_PROJECTION_OFFSET 16
#define RS_PROGRAM_VERTEX_TEXTURE_OFFSET 32

typedef struct {
    const void * (*loadEnvVp)(uint32_t bank, uint32_t offset);

    float (*loadEnvF)(uint32_t bank, uint32_t offset);
    int32_t (*loadEnvI32)(uint32_t bank, uint32_t offset);
    uint32_t (*loadEnvU32)(uint32_t bank, uint32_t offset);
    void (*loadEnvVec4)(uint32_t bank, uint32_t offset, rsc_Vector4 *);
    void (*loadEnvMatrix)(uint32_t bank, uint32_t offset, rsc_Matrix *);

    void (*storeEnvF)(uint32_t bank, uint32_t offset, float);
    void (*storeEnvI32)(uint32_t bank, uint32_t offset, int32_t);
    void (*storeEnvU32)(uint32_t bank, uint32_t offset, uint32_t);
    void (*storeEnvVec4)(uint32_t bank, uint32_t offset, const rsc_Vector4 *);
    void (*storeEnvMatrix)(uint32_t bank, uint32_t offset, const rsc_Matrix *);

    void (*matrixLoadIdentity)(rsc_Matrix *);
    void (*matrixLoadFloat)(rsc_Matrix *, const float *);
    void (*matrixLoadMat)(rsc_Matrix *, const rsc_Matrix *);
    void (*matrixLoadRotate)(rsc_Matrix *, float rot, float x, float y, float z);
    void (*matrixLoadScale)(rsc_Matrix *, float x, float y, float z);
    void (*matrixLoadTranslate)(rsc_Matrix *, float x, float y, float z);
    void (*matrixLoadMultiply)(rsc_Matrix *, const rsc_Matrix *lhs, const rsc_Matrix *rhs);
    void (*matrixMultiply)(rsc_Matrix *, const rsc_Matrix *rhs);
    void (*matrixRotate)(rsc_Matrix *, float rot, float x, float y, float z);
    void (*matrixScale)(rsc_Matrix *, float x, float y, float z);
    void (*matrixTranslate)(rsc_Matrix *, float x, float y, float z);

    void (*color)(float r, float g, float b, float a);

    void (*programFragmentBindTexture)(RsProgramFragment, uint32_t slot, RsAllocation);
    void (*programFragmentBindSampler)(RsProgramFragment, uint32_t slot, RsAllocation);

    void (*materialDiffuse)(float r, float g, float b, float a);
    void (*materialSpecular)(float r, float g, float b, float a);
    void (*lightPosition)(float x, float y, float z, float w);
    void (*materialShininess)(float s);

    void (*uploadToTexture)(RsAllocation va, uint32_t baseMipLevel);

    void (*enable)(uint32_t);
    void (*disable)(uint32_t);

    uint32_t (*rand)(uint32_t max);

    void (*contextBindProgramFragment)(RsProgramFragment pf);
    void (*contextBindProgramFragmentStore)(RsProgramFragmentStore pfs);


    // Drawing funcs
    void (*renderTriangleMesh)(RsTriangleMesh);
    void (*renderTriangleMeshRange)(RsTriangleMesh, uint32_t start, uint32_t count);

    // Assumes (GL_FIXED) x,y,z (GL_UNSIGNED_BYTE)r,g,b,a
    void (*drawTriangleArray)(RsAllocation alloc, uint32_t count);

    void (*drawRect)(int32_t x1, int32_t x2, int32_t y1, int32_t y2);
} rsc_FunctionTable;

typedef int (*rsc_RunScript)(uint32_t launchIndex, const rsc_FunctionTable *);
//typedef int (*rsc_RunScript)(uint32_t launchIndex, const rsc_FunctionTable *);


/* EnableCap */
+10 −21
Original line number Diff line number Diff line
@@ -23,47 +23,36 @@ int main(int index)
{
    int f1,f2,f3,f4, f5,f6,f7,f8, f9,f10,f11,f12, f13,f14,f15,f16;
    int g1,g2,g3,g4, g5,g6,g7,g8, g9,g10,g11,g12, g13,g14,g15,g16;
    int float_1;
    int float_0;
    int float_2;
    int float_90;
    int float_0_5;
    int trans;  // float
    int rot;   // float
    float trans;
    float rot;
    int x;
    float focusPos;  // float
    int focusID;
    int lastFocusID;
    int imgCount;

    float_2 = intToFloat(2);
    float_1 = intToFloat(1);
    float_0 = intToFloat(0);
    float_90= intToFloat(90);
    float_0_5 = fixedtoFloat(0x8000);

    trans = loadF(1, 0);
    rot = loadF(1, 1);

    matrixLoadScale(&f16, float_2, float_2, float_2);
    matrixTranslate(&f16, 0, 0, trans);
    matrixRotate(&f16, float_90, 0, 0, float_1);
    matrixRotate(&f16, rot, float_1, 0, 0);
    storeEnvMatrix(3, 0, &f16);
    matrixLoadScale(&f16, 2.f, 2.f, 2.f);
    matrixTranslate(&f16, 0.f, 0.f, trans);
    matrixRotate(&f16, 90.f, 0.f, 0.f, 1.f);
    matrixRotate(&f16, rot, 1.f, 0.f, 0.f);
    storeMatrix(3, 0, &f16);

    //materialDiffuse(con, 0.0f, 0.0f, 0.0f, 1.0f);
    //materialSpecular(con, 0.5f, 0.5f, 0.5f, 0.5f);
    //materialShininess(intToFloat(20));
    //lightPosition(con, 0.2f, -0.2f, -2.0f, 0.0f);
    //enable(con, GL_LIGHTING);
    renderTriangleMesh(NAMED_mesh);
    drawTriangleMesh(NAMED_mesh);



    //int imgId = 0;

    contextBindProgramFragmentStore(NAMED_PFImages);
    contextBindProgramFragment(NAMED_PFSImages);
    bindProgramFragmentStore(NAMED_PFImages);
    bindProgramFragment(NAMED_PFSImages);

    //focusPos = loadF(1, 2);
    //focusID = 0;
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ int main(void* con, int ft, int launchID)
        for (y = rowCount -1; (y >= 0) && iconCount; y--) {
            float ty1 = ((y * 3.0f) - 4.5f) * scale;
            float ty2 = ty1 + scale * 2.f;
            pfBindTexture(NAMED_PF, 0, loadI32(1, y));
            bindTexture(NAMED_PF, 0, loadI32(1, y));
            color(1.0f, 1.0f, 1.0f, 1.0f);
            if (done && (index != selectedID)) {
                color(0.4f, 0.4f, 0.4f, 1.0f);
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ public class RolloView extends RSSurfaceView {
            // icon control
            if(act != ev.ACTION_UP) {
                if(mFlingMode) {
                    mColumn += (mFlingX - nx) * 5;
                    mColumn += (mFlingX - nx) * 4;
                    setColumn(true);
                }
                mFlingMode = true;
Loading