Skip to content

Commit

Permalink
added 'setQuad' method to QuadBatch class
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimaryFeather authored and Oldes committed Dec 3, 2014
1 parent 3b1c405 commit a9c6266
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions starling/src/starling/display/QuadBatch.as
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ package starling.display
mSyncRequired = true;
mNumQuads++;
}

/** Adds another QuadBatch to this batch. Just like the 'addQuad' method, you have to
* make sure that you only add batches with an equal state. */
public function addQuadBatch(quadBatch:QuadBatch, parentAlpha:Number=1.0,
Expand Down Expand Up @@ -427,7 +427,20 @@ package starling.display

mSyncRequired = true;
}


/** Replaces a quad or image at a certain index with another one. */
public function setQuad(quadID:Number, quad:Quad):void
{
var matrix:Matrix = quad.transformationMatrix;
var alpha:Number = quad.alpha;
var vertexID:int = quadID * 4;

quad.copyVertexDataTransformedTo(mVertexData, vertexID, matrix);
if (alpha != 1.0) mVertexData.scaleAlpha(vertexID, alpha, 4);

mSyncRequired = true;
}

/** Calculates the bounds of a specific quad, optionally transformed by a matrix.
* If you pass a 'resultRect', the result will be stored in this rectangle
* instead of creating a new object. */
Expand Down

0 comments on commit a9c6266

Please sign in to comment.