CCTransformHelp.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /****************************************************************************
  2. Copyright (c) 2013-2017 Chukong Technologies Inc.
  3. http://www.cocos2d-x.org
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated documentation files (the "Software"), to deal
  6. in the Software without restriction, including without limitation the rights
  7. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. ****************************************************************************/
  20. #ifndef __CCTRANSFORMHELP_H__
  21. #define __CCTRANSFORMHELP_H__
  22. #include "editor-support/cocostudio/CCArmatureDefine.h"
  23. #include "editor-support/cocostudio/CCDatas.h"
  24. #include "editor-support/cocostudio/CocosStudioExport.h"
  25. namespace cocostudio {
  26. /*
  27. * use to calculate the matrix of node from parent node
  28. * @js NA
  29. * @lua NA
  30. */
  31. class CC_STUDIO_DLL TransformHelp
  32. {
  33. public:
  34. TransformHelp();
  35. static void transformFromParent(BaseData &node, const BaseData &parentNode);
  36. static void transformToParent(BaseData &node, const BaseData &parentNode);
  37. static void transformFromParentWithoutScale(BaseData &node, const BaseData &parentNode);
  38. static void transformToParentWithoutScale(BaseData &node, const BaseData &parentNode);
  39. static void nodeToMatrix(const BaseData &_node, cocos2d::AffineTransform &_matrix);
  40. static void nodeToMatrix(const BaseData &node, cocos2d::Mat4 &matrix);
  41. static void matrixToNode(const cocos2d::AffineTransform &_matrix, BaseData &_node);
  42. static void matrixToNode(const cocos2d::Mat4 &_matrix, BaseData &_node);
  43. static void nodeConcat(BaseData &target, BaseData &source);
  44. static void nodeSub(BaseData &target, BaseData &source);
  45. public:
  46. static cocos2d::AffineTransform helpMatrix1;
  47. static cocos2d::AffineTransform helpMatrix2;
  48. static cocos2d::Vec2 helpPoint1;
  49. static cocos2d::Vec2 helpPoint2;
  50. };
  51. }
  52. #endif /*__CCTRANSFORMHELP_H__*/