private void createProgramFragmentStore() { ProgramStore.Builder builder = new ProgramStore.Builder(mRS); builder.setDepthFunc(ALWAYS); builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE); builder.setDitherEnabled(false); builder.setDepthMaskEnabled(true); mPfsBackground = builder.create(); builder = new ProgramStore.Builder(mRS); builder.setDepthFunc(ALWAYS); builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); builder.setDitherEnabled(false); builder.setDepthMaskEnabled(true); mPfsLeaf = builder.create(); mScript.set_g_PFSLeaf(mPfsLeaf); mScript.set_g_PFSBackground(mPfsBackground); }
/** * Returns a pre-defined program store object with the following characteristics: - incoming * pixels always pass the depth test and their value is not stored in the depth buffer - incoming * pixel's value is combined with the stored color (Dest) using the following formula Final.RGB = * Source.RGB * Source.A + Dest.RGB * (1 - Source.A) * * @param rs Context to which the program will belong. */ public static ProgramStore BLEND_ALPHA_DEPTH_NONE(RenderScript rs) { if (rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH == null) { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); builder.setDitherEnabled(false); builder.setDepthMaskEnabled(false); rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH = builder.create(); } return rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH; }
/** * Returns a pre-defined program store object with the following characteristics: - incoming * pixels are drawn if their depth value is less than the stored value in the depth buffer. If the * pixel is drawn, its value is also stored in the depth buffer - incoming pixels override the * value stored in the color buffer if it passes the depth test * * @param rs Context to which the program will belong. */ public static ProgramStore BLEND_NONE_DEPTH_TEST(RenderScript rs) { if (rs.mProgramStore_BLEND_NONE_DEPTH_TEST == null) { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.LESS); builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO); builder.setDitherEnabled(false); builder.setDepthMaskEnabled(true); rs.mProgramStore_BLEND_NONE_DEPTH_TEST = builder.create(); } return rs.mProgramStore_BLEND_NONE_DEPTH_TEST; }