本文整理汇总了C#中FSprite.UpdateMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# FSprite.UpdateMatrix方法的具体用法?C# FSprite.UpdateMatrix怎么用?C# FSprite.UpdateMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSprite
的用法示例。
在下文中一共展示了FSprite.UpdateMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetHole0
public void SetHole0(FSprite spriteHole)
{
_hole0Sprite=spriteHole;
_hole0Texture=spriteHole.element.atlas.texture;
spriteHole.UpdateMatrix();
float factorX=Futile.resourceScale/spriteHole.element.atlas.textureSize.x;
float factorY=Futile.resourceScale/spriteHole.element.atlas.textureSize.y;
//do this if you have modified version of FElement that keeps the frame info
_hole0LocalToUVParams=new Vector4( factorX , (spriteHole.element.frame.x+(-spriteHole.textureRect.x-spriteHole.element.sourceRect.x)*Futile.resourceScale)/spriteHole.element.atlas.textureSize.x , factorY , 1+(-(spriteHole.element.frame.y+spriteHole.element.frame.height)+(-spriteHole.textureRect.y-spriteHole.element.sourceRect.y)*Futile.resourceScale)/spriteHole.element.atlas.textureSize.y );
//float elementFrameX=spriteHole.element.uvRect.x*spriteHole.element.atlas.textureSize.x;
//float elementFrameY=-spriteHole.element.uvRect.y*spriteHole.element.atlas.textureSize.y+spriteHole.element.atlas.textureSize.y-spriteHole.element.uvRect.height*spriteHole.element.atlas.textureSize.y;
//_hole0LocalToUVParams=new Vector4( factorX , (elementFrameX+(-spriteHole.textureRect.x-spriteHole.element.sourceRect.x)*Futile.resourceScale)/spriteHole.element.atlas.textureSize.x , factorY , 1+(-(elementFrameY+spriteHole.element.frame.height)+(-spriteHole.textureRect.y-spriteHole.element.sourceRect.y)*Futile.resourceScale)/spriteHole.element.atlas.textureSize.y );
_hole0UVRect.x=spriteHole.element.uvRect.xMin;
_hole0UVRect.y=spriteHole.element.uvRect.yMin;
_hole0UVRect.z=spriteHole.element.uvRect.xMax;
_hole0UVRect.w=spriteHole.element.uvRect.yMax;
//test
/* the old way of computing the uv in shader
_hole0MatrixABCD=new Vector4(spriteHole.screenInverseConcatenatedMatrix.a,spriteHole.screenInverseConcatenatedMatrix.b,spriteHole.screenInverseConcatenatedMatrix.c,spriteHole.screenInverseConcatenatedMatrix.d);
_hole0MatrixTxTy=new Vector4(spriteHole.screenInverseConcatenatedMatrix.tx,spriteHole.screenInverseConcatenatedMatrix.ty,0,0);
Vector2 vertex=new Vector2(spriteHole.x,spriteHole.y);
//vertex.x+=100;
Vector2 tmp=new Vector2 ( (vertex.x+_screenParams.x)*_screenParams.z , (vertex.y+_screenParams.y)*_screenParams.z );
//futile local sprite coords
Vector2 local=new Vector2 ( tmp.x*_hole0MatrixABCD.x + tmp.y*_hole0MatrixABCD.z + _hole0MatrixTxTy.x , tmp.x*_hole0MatrixABCD.y + tmp.y*_hole0MatrixABCD.w + _hole0MatrixTxTy.y );
//uv
Vector2 uv=new Vector2 (local.x*_hole0LocalToUVParams.x + _hole0LocalToUVParams.y , local.y*_hole0LocalToUVParams.z + _hole0LocalToUVParams.w );
Vector2 uv2=new Vector2 (
//((vertex.x+_screenParams.x)*_screenParams.z*_hole0MatrixABCD.x + (vertex.y+_screenParams.y)*_screenParams.z*_hole0MatrixABCD.z + _hole0MatrixTxTy.x)*_hole0LocalToUVParams.x + _hole0LocalToUVParams.y ,
vertex.x*_screenParams.z*_hole0MatrixABCD.x*_hole0LocalToUVParams.x + vertex.y*_screenParams.z*_hole0MatrixABCD.z*_hole0LocalToUVParams.x + (_screenParams.x*_screenParams.z*_hole0MatrixABCD.x + _screenParams.y*_screenParams.z*_hole0MatrixABCD.z + _hole0MatrixTxTy.x)*_hole0LocalToUVParams.x + _hole0LocalToUVParams.y,
//((vertex.x+_screenParams.x)*_screenParams.z*_hole0MatrixABCD.y + (vertex.y+_screenParams.y)*_screenParams.z*_hole0MatrixABCD.w + _hole0MatrixTxTy.y)*_hole0LocalToUVParams.z + _hole0LocalToUVParams.w ,
vertex.x*_screenParams.z*_hole0MatrixABCD.y*_hole0LocalToUVParams.z + vertex.y*_screenParams.z*_hole0MatrixABCD.w*_hole0LocalToUVParams.z + (_screenParams.x*_screenParams.z*_hole0MatrixABCD.y + _screenParams.y*_screenParams.z*_hole0MatrixABCD.w + _hole0MatrixTxTy.y)*_hole0LocalToUVParams.z + _hole0LocalToUVParams.w
);
/**/
Hole0NeedUpdate();
/*
_hole0MatrixABCD.x=_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.a*_hole0LocalToUVParams.x;
_hole0MatrixABCD.z=_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.c*_hole0LocalToUVParams.x;
_hole0MatrixTxTy.x=(_screenParams.x*_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.a + _screenParams.y*_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.c + _hole0MatrixTxTy.x)*_hole0LocalToUVParams.x + _hole0LocalToUVParams.y;
_hole0MatrixABCD.y=_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.b*_hole0LocalToUVParams.z;
_hole0MatrixABCD.w=_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.d*_hole0LocalToUVParams.z;
_hole0MatrixTxTy.y=(_screenParams.x*_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.b + _screenParams.y*_screenParams.z*spriteHole.screenInverseConcatenatedMatrix.d + _hole0MatrixTxTy.y)*_hole0LocalToUVParams.z + _hole0LocalToUVParams.w;
Vector2 uv3=new Vector2 ( _hole0Sprite.x*_hole0MatrixABCD.x + _hole0Sprite.y*_hole0MatrixABCD.z + _hole0MatrixTxTy.x , _hole0Sprite.x*_hole0MatrixABCD.y + _hole0Sprite.y*_hole0MatrixABCD.w + _hole0MatrixTxTy.y );
*/
needsApply = true;
}