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

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

All light source objects.

parent af49c744
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ LOCAL_SRC_FILES:= \
	rsContext.cpp \
	rsDevice.cpp \
	rsElement.cpp \
	rsLight.cpp \
	rsLocklessFifo.cpp \
	rsObjectBase.cpp \
	rsMatrix.cpp \
+1 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ typedef void * RsScript;
typedef void * RsScriptBasicTemp;
typedef void * RsTriangleMesh;
typedef void * RsType;
typedef void * RsLight;

typedef void * RsProgramVertex;
typedef void * RsProgramFragment;
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ typedef void * RsTriangleMesh;
typedef void * RsType;
typedef void * RsProgramFragment;
typedef void * RsProgramFragmentStore;
typedef void * RsLight;


typedef struct {
+5 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ public class FilmRS {
    private RenderScript.Allocation mAllocState;
    private RenderScript.Allocation mAllocPV;
    private RenderScript.TriangleMesh mMesh;
    private RenderScript.Light mLight;

    private float[] mBufferPos;
    private float[] mBufferPV;
@@ -144,6 +145,10 @@ public class FilmRS {
        mPV = mRS.programVertexCreate();
        mPV.setName("PV");

        mRS.lightBegin();
        mLight = mRS.lightCreate();
        mLight.setPosition(0, -0.5f, -1.0f);

        Log.e("rs", "Done loading named");
    }

+46 −0
Original line number Diff line number Diff line
@@ -157,6 +157,14 @@ public class RenderScript {
    native private void nProgramVertexSetTextureMatrixEnable(boolean enable);
    native private int  nProgramVertexCreate();

    native private void nLightBegin();
    native private void nLightSetIsMono(boolean isMono);
    native private void nLightSetIsLocal(boolean isLocal);
    native private int  nLightCreate();
    native private void nLightDestroy(int l);
    native private void nLightSetColor(int l, float r, float g, float b);
    native private void nLightSetPosition(int l, float x, float y, float z);


    private int     mDev;
    private int     mContext;
@@ -869,6 +877,44 @@ public class RenderScript {
        return new Sampler(id);
    }

    //////////////////////////////////////////////////////////////////////////////////
    // Light

    public class Light extends BaseObj {
        Light(int id) {
            mID = id;
        }

        public void destroy() {
            nLightDestroy(mID);
            mID = 0;
        }

        public void setColor(float r, float g, float b) {
            nLightSetColor(mID, r, g, b);
        }

        public void setPosition(float x, float y, float z) {
            nLightSetPosition(mID, x, y, z);
        }
    }

    public void lightBegin() {
        nLightBegin();
    }

    public void lightSetIsMono(boolean isMono) {
        nLightSetIsMono(isMono);
    }

    public void lightSetIsLocal(boolean isLocal) {
        nLightSetIsLocal(isLocal);
    }

    public Light lightCreate() {
        int id = nLightCreate();
        return new Light(id);
    }

    ///////////////////////////////////////////////////////////////////////////////////
    // Root state
Loading