protected override void activate(int pass, AsContext3D context, AsTexture texture) { updateParameters(pass, (int)(texture.getWidth() * texture.getScale()), (int)(texture.getHeight() * texture.getScale())); context.setProgramConstantsFromVector(AsContext3DProgramType.VERTEX, 4, mOffsets); context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 0, mWeights); if (mUniformColor && pass == getNumPasses() - 1) { context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 1, mColor); context.setProgram(mTintedProgram); } else { context.setProgram(mNormalProgram); } }
public virtual void renderCustom(AsMatrix mvpMatrix, float parentAlpha, String blendMode) { if (mNumQuads == 0) { return; } if (mSyncRequired) { syncBuffers(); } bool pma = mVertexData.getPremultipliedAlpha(); AsContext3D context = AsStarling.getContext(); bool tinted = mTinted || (parentAlpha != 1.0f); String programName = mTexture != null?getImageProgramName(tinted, mTexture.getMipMapping(), mTexture.getRepeat(), mTexture.getFormat(), mSmoothing) : QUAD_PROGRAM_NAME; sRenderAlpha[0] = sRenderAlpha[1] = sRenderAlpha[2] = pma ? parentAlpha : 1.0f; sRenderAlpha[3] = parentAlpha; AsMatrixUtil.convertTo3D(mvpMatrix, sRenderMatrix); AsRenderSupport.setBlendFactors(pma, blendMode != null ? blendMode : this.getBlendMode()); context.setProgram(AsStarling.getCurrent().getProgram(programName)); context.setProgramConstantsFromVector(AsContext3DProgramType.VERTEX, 0, sRenderAlpha, 1); context.setProgramConstantsFromMatrix(AsContext3DProgramType.VERTEX, 1, sRenderMatrix, true); context.setVertexBufferAt(0, mVertexBuffer, AsVertexData.POSITION_OFFSET, AsContext3DVertexBufferFormat.FLOAT_2); if (mTexture == null || tinted) { context.setVertexBufferAt(1, mVertexBuffer, AsVertexData.COLOR_OFFSET, AsContext3DVertexBufferFormat.FLOAT_4); } if (mTexture != null) { context.setTextureAt(0, mTexture.get_base()); context.setVertexBufferAt(2, mVertexBuffer, AsVertexData.TEXCOORD_OFFSET, AsContext3DVertexBufferFormat.FLOAT_2); } context.drawTriangles(mIndexBuffer, 0, mNumQuads * 2); if (mTexture != null) { context.setTextureAt(0, null); context.setVertexBufferAt(2, null); } context.setVertexBufferAt(1, null); context.setVertexBufferAt(0, null); }
protected override void activate(int pass, AsContext3D context, AsTexture texture) { context.setProgram(mShaderProgram); }
protected override void activate(int pass, AsContext3D context, AsTexture texture) { context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 0, mQuantifiers, 1); context.setProgram(mShaderProgram); }
protected override void activate(int pass, AsContext3D context, AsTexture texture) { context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 0, mShaderMatrix); context.setProgramConstantsFromVector(AsContext3DProgramType.FRAGMENT, 5, MIN_COLOR); context.setProgram(mShaderProgram); }