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);
 }
Exemplo n.º 2
0
 public AsQuadBatch()
 {
     mVertexData   = new AsVertexData(0, true);
     mIndexData    = new AsVector <uint>();
     mNumQuads     = 0;
     mTinted       = false;
     mSyncRequired = false;
     AsStarling.getCurrent().getStage3D().addEventListener(AsEvent.CONTEXT3D_CREATE, onContextCreated, false, 0, true);
 }
Exemplo n.º 3
0
 public override void copyVertexDataTo(AsVertexData targetData, int targetVertexID)
 {
     if (mVertexDataCacheInvalid)
     {
         mVertexDataCacheInvalid = false;
         mVertexData.copyTo(mVertexDataCache);
         mTexture.adjustVertexData(mVertexDataCache, 0, 4);
     }
     mVertexDataCache.copyTo(targetData, targetVertexID);
 }
Exemplo n.º 4
0
 public AsQuad(float width, float height, uint color, bool premultipliedAlpha)
 {
     mTinted     = color != 0xffffff;
     mVertexData = new AsVertexData(4, premultipliedAlpha);
     mVertexData.setPosition(0, 0.0f, 0.0f);
     mVertexData.setPosition(1, width, 0.0f);
     mVertexData.setPosition(2, 0.0f, height);
     mVertexData.setPosition(3, width, height);
     mVertexData.setUniformColor(color);
     onVertexDataChanged();
 }
Exemplo n.º 5
0
        public AsImage(AsTexture texture)
            : base(texture.getFrame() != null ? texture.getFrame().width : texture.getWidth(), texture.getFrame() != null ? texture.getFrame().height : texture.getHeight(), 0xffffff, texture.getPremultipliedAlpha())
        {
            bool pma = texture.getPremultipliedAlpha();

            mVertexData.setTexCoords(0, 0.0f, 0.0f);
            mVertexData.setTexCoords(1, 1.0f, 0.0f);
            mVertexData.setTexCoords(2, 0.0f, 1.0f);
            mVertexData.setTexCoords(3, 1.0f, 1.0f);
            mTexture                = texture;
            mSmoothing              = AsTextureSmoothing.BILINEAR;
            mVertexDataCache        = new AsVertexData(4, pma);
            mVertexDataCacheInvalid = 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);
            }
        }
Exemplo n.º 7
0
 public virtual void adjustVertexData(AsVertexData vertexData, int vertexID, int count)
 {
     if (mFrame != null)
     {
         if (count != 4)
         {
             throw new AsArgumentError("Textures with a frame can only be used on quads");
         }
         float deltaRight  = mFrame.width + mFrame.x - getWidth();
         float deltaBottom = mFrame.height + mFrame.y - getHeight();
         vertexData.translateVertex(vertexID, -mFrame.x, -mFrame.y);
         vertexData.translateVertex(vertexID + 1, -deltaRight, -mFrame.y);
         vertexData.translateVertex(vertexID + 2, -mFrame.x, -deltaBottom);
         vertexData.translateVertex(vertexID + 3, -deltaRight, -deltaBottom);
     }
 }
Exemplo n.º 8
0
 public virtual void copyVertexDataTo(AsVertexData targetData)
 {
     copyVertexDataTo(targetData, 0);
 }
Exemplo n.º 9
0
 public virtual void copyVertexDataTo(AsVertexData targetData, int targetVertexID)
 {
     mVertexData.copyTo(targetData, targetVertexID);
 }