public AsFragmentFilter(int numPasses, float resolution) { if (AsCapabilities.getIsDebugger() && AsGlobal.getQualifiedClassName(this) == "starling.filters::FragmentFilter") { throw new AsAbstractClassError(); } if (numPasses < 1) { throw new AsArgumentError("At least one pass is required."); } mNumPasses = numPasses; mMarginX = mMarginY = 0.0f; mOffsetX = mOffsetY = 0; mResolution = resolution; mMode = AsFragmentFilterMode.REPLACE; mVertexData = new AsVertexData(4); mVertexData.setTexCoords(0, 0, 0); mVertexData.setTexCoords(1, 1, 0); mVertexData.setTexCoords(2, 0, 1); mVertexData.setTexCoords(3, 1, 1); mIndexData = new AsVector <uint>(); mIndexData.setOwnProperty("_fixed", true); createPrograms(); AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true); }
public override void adjustVertexData(AsVertexData vertexData, int vertexID, int count) { base.adjustVertexData(vertexData, vertexID, count); float clipX = mRootClipping.x; float clipY = mRootClipping.y; float clipWidth = mRootClipping.width; float clipHeight = mRootClipping.height; int endIndex = vertexID + count; int i = vertexID; for (; i < endIndex; ++i) { vertexData.getTexCoords(i, sTexCoords); vertexData.setTexCoords(i, clipX + sTexCoords.x * clipWidth, clipY + sTexCoords.y * clipHeight); } }