diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Graphics/SpriteUtility.h |
Diffstat (limited to 'Runtime/Graphics/SpriteUtility.h')
-rw-r--r-- | Runtime/Graphics/SpriteUtility.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Runtime/Graphics/SpriteUtility.h b/Runtime/Graphics/SpriteUtility.h new file mode 100644 index 0000000..aff8491 --- /dev/null +++ b/Runtime/Graphics/SpriteUtility.h @@ -0,0 +1,22 @@ +#pragma once +#include "Configuration/UnityConfigure.h" + +#if ENABLE_SPRITES +#include "Runtime/Graphics/Texture2D.h" +#include "Runtime/Graphics/SpriteFrame.h" + +enum PathSimplifyMode +{ + kPathReduce=0, + kPathEmbed +}; + +void GenerateSpriteOutline(PPtr<Texture2D> texture, float pixelsToUnits, const Rectf& rect, const Vector2f& rectOffset, float detail, unsigned char alphaTolerance, bool holeDetection, unsigned int extrude, int simplifyMode, std::vector<dynamic_array<Vector2f> >* outLine = NULL, std::vector<SpriteVertex>* outVertices = NULL, std::vector<UInt16>* outIndices = NULL, Rectf* meshRect = NULL); + +// Returns the front face of the AABB. +// Sprite is on local Z = 0, however the AABB has volume. Flatten it on Z and return 4 vertices only. +void GetAABBVerticesForSprite (const AABB& aabb, Vector3f* outVertices); + +bool GetSpriteMeshRectPixelBounds (const Texture2D& texture, const Rectf& rectInaccurate, int& rectX, int& rectY, int& rectRight, int& rectBottom); + +#endif //ENABLE_SPRITES |