Search in sources :

Example 11 with RenderScriptGL

use of android.renderscript.RenderScriptGL in project android_frameworks_base by ParanoidAndroid.

the class Camera method getRSData.

ScriptField_Camera_s getRSData() {
    if (mField != null) {
        return mField;
    }
    RenderScriptGL rs = SceneManager.getRS();
    if (rs == null) {
        return null;
    }
    if (mTransform == null) {
        throw new RuntimeException("Cameras without transforms are invalid");
    }
    mField = new ScriptField_Camera_s(rs, 1);
    mData.transformMatrix = mTransform.getRSData().getAllocation();
    mData.transformTimestamp = 1;
    mData.timestamp = 1;
    mData.isDirty = 1;
    mData.name = getNameAlloc(rs);
    mField.set(mData, 0, true);
    return mField;
}
Also used : RenderScriptGL(android.renderscript.RenderScriptGL)

Example 12 with RenderScriptGL

use of android.renderscript.RenderScriptGL in project android_frameworks_base by ParanoidAndroid.

the class Camera method setName.

public void setName(String n) {
    super.setName(n);
    if (mField != null) {
        RenderScriptGL rs = SceneManager.getRS();
        mData.name = getNameAlloc(rs);
        mField.set_name(0, mData.name, true);
        mField.set_isDirty(0, 1, true);
    }
}
Also used : RenderScriptGL(android.renderscript.RenderScriptGL)

Example 13 with RenderScriptGL

use of android.renderscript.RenderScriptGL in project android_frameworks_base by ParanoidAndroid.

the class SceneManager method getTextureFS.

public static FragmentShader getTextureFS() {
    if (sSceneManager == null) {
        return null;
    }
    if (sSceneManager.mTexture == null) {
        RenderScriptGL rs = getRS();
        final String code = "\n" + "varying vec2 varTex0;\n" + "void main() {\n" + "   lowp vec4 col = texture2D(UNI_color, varTex0).rgba;\n" + "   gl_FragColor = col;\n" + "}\n";
        FragmentShader.Builder fb = new FragmentShader.Builder(rs);
        fb.setShader(code);
        fb.addTexture(Program.TextureType.TEXTURE_2D, "color");
        sSceneManager.mTexture = fb.create();
        sSceneManager.mTexture.mProgram.bindSampler(Sampler.CLAMP_LINEAR_MIP_LINEAR(rs), 0);
    }
    return sSceneManager.mTexture;
}
Also used : FragmentShader(com.android.scenegraph.FragmentShader) RenderScriptGL(android.renderscript.RenderScriptGL)

Aggregations

RenderScriptGL (android.renderscript.RenderScriptGL)13 FragmentShader (com.android.scenegraph.FragmentShader)2 MipmapControl (android.renderscript.Allocation.MipmapControl)1 Element (android.renderscript.Element)1 VertexShader (com.android.scenegraph.VertexShader)1