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); }
public virtual AsMatrix3D getMvpMatrix3D() { return(AsMatrixUtil.convertTo3D(getMvpMatrix(), mMvpMatrix3D)); }