mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 22:19:31 +07:00
Cooking flash animations. Fix image alpha bug.
This commit is contained in:
9
Assets/FlashTools/Examples/Animations/Cooking.meta
Normal file
9
Assets/FlashTools/Examples/Animations/Cooking.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 992fe7e47be2d4be2befccb54ded7d88
|
||||
folderAsset: yes
|
||||
timeCreated: 1470846822
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 1.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 1.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 252bb347f63ae4732bf9e02fb02e4b69
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 2.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 2.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3cbae74f670a7482bab078ad08a2e280
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 3.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 3.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35acda73c30684e3baaf4eaa7e9833b1
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 4.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 4.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77991ffc33b5844beab5adaf0729a2c4
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 5.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 5.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81415dbbf80674ee395e157b9356abaf
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 6.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Char 6.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68ff2a8e362274215a0881db1c19f095
|
||||
timeCreated: 1470848546
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/FlashTools/Examples/Animations/Cooking/Chef.fla
Normal file
BIN
Assets/FlashTools/Examples/Animations/Cooking/Chef.fla
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c96cd61ef8b654bb6984ea73f0feb821
|
||||
timeCreated: 1470929047
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -134,7 +134,7 @@ Camera:
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0.019607844}
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
@@ -145,8 +145,8 @@ Camera:
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 3
|
||||
m_Depth: -1
|
||||
orthographic size: 5.5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
|
||||
@@ -183,9 +183,10 @@ namespace FlashTools.Internal {
|
||||
var textures = bitmap_defines
|
||||
.Select(p => LoadTextureFromBitmapDefine(p.Value));
|
||||
|
||||
var atlas = new Texture2D(0, 0);
|
||||
var atlas = new Texture2D(0, 0, TextureFormat.ARGB32, false);
|
||||
var atlas_rects = atlas.PackTextures(
|
||||
textures.ToArray(), asset.AtlasPadding, asset.MaxAtlasSize);
|
||||
|
||||
File.WriteAllBytes(
|
||||
GetAtlasPath(swf_asset),
|
||||
atlas.EncodeToPNG());
|
||||
@@ -212,9 +213,25 @@ namespace FlashTools.Internal {
|
||||
bitmap.Width, bitmap.Height,
|
||||
TextureFormat.ARGB32, false);
|
||||
texture.LoadRawTextureData(bitmap.ARGB32);
|
||||
RevertTexturePremultipliedAlpha(texture);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void RevertTexturePremultipliedAlpha(Texture2D texture) {
|
||||
for (int y = 0; y < texture.height; ++y) {
|
||||
for (int x = 0; x < texture.width; ++x) {
|
||||
var c = texture.GetPixel(x, y);
|
||||
if ( c.a > 0 ) {
|
||||
c.r /= c.a;
|
||||
c.g /= c.a;
|
||||
c.b /= c.a;
|
||||
}
|
||||
texture.SetPixel(x, y, c);
|
||||
}
|
||||
}
|
||||
texture.Apply();
|
||||
}
|
||||
|
||||
static string GetAtlasPath(string swf_asset) {
|
||||
return Path.ChangeExtension(swf_asset, ".png");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user