mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Container Canvas Rendering function
This commit is contained in:
parent
bea7ca36ad
commit
5026566084
2 changed files with 22 additions and 8 deletions
|
@ -73,13 +73,7 @@ var Container = new Class({
|
|||
tempMatrix.transformPoint(pointSrc.x, pointSrc.y, pointDst);
|
||||
|
||||
return pointDst;
|
||||
},
|
||||
|
||||
hasPoint: function (gameObject, point)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
module.exports = Container;
|
||||
|
|
|
@ -1,12 +1,32 @@
|
|||
var GameObject = require('../GameObject');
|
||||
|
||||
var ContainerCanvasRenderer = function (renderer, src, interpolationPercentage, camera)
|
||||
var ContainerCanvasRenderer = function (renderer, container, interpolationPercentage, camera, parentMatrix)
|
||||
{
|
||||
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||
if (GameObject.RENDER_MASK !== container.renderFlags || (container.cameraFilter > 0 && (container.cameraFilter & camera._id)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var children = container.children;
|
||||
var transformMatrix = container.localTransform;
|
||||
|
||||
if (parentMatrix === undefined)
|
||||
{
|
||||
transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY);
|
||||
}
|
||||
else
|
||||
{
|
||||
transformMatrix.loadIdentity();
|
||||
transformMatrix.multiply(parentMatrix);
|
||||
transformMatrix.translate(container.x, container.y);
|
||||
transformMatrix.rotate(container.rotation);
|
||||
transformMatrix.scale(container.scaleX, container.scaleY);
|
||||
}
|
||||
|
||||
for (var index = 0; index < children.length; ++index)
|
||||
{
|
||||
children[index].renderCanvas(renderer, children[index], interpolationPercentage, camera, transformMatrix);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ContainerCanvasRenderer;
|
Loading…
Reference in a new issue