mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-16 22:19:31 +07:00
cut invisible geometry
This commit is contained in:
@@ -208,7 +208,7 @@ namespace FlashTools.Internal {
|
||||
var bitmap = inst != null
|
||||
? FindBitmapFromAssetData(asset.Data, inst.Bitmap)
|
||||
: null;
|
||||
if ( bitmap != null ) {
|
||||
if ( bitmap != null && IsVisibleInstance(inst) ) {
|
||||
var width = bitmap.RealSize.x / 20.0f;
|
||||
var height = bitmap.RealSize.y / 20.0f;
|
||||
|
||||
@@ -335,6 +335,11 @@ namespace FlashTools.Internal {
|
||||
return null;
|
||||
}
|
||||
|
||||
static bool IsVisibleInstance(SwfInstanceData inst) {
|
||||
var result_color = inst.ColorTrans.ApplyToColor(Color.white);
|
||||
return result_color.a >= 0.01f;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// ConfigureAssetClips
|
||||
|
||||
@@ -42,6 +42,14 @@ namespace FlashTools {
|
||||
public Vector4 Mul;
|
||||
public Vector4 Add;
|
||||
|
||||
public Color ApplyToColor(Color color) {
|
||||
return new Color(
|
||||
Mathf.Clamp01(color.r * Mul.x + Add.x),
|
||||
Mathf.Clamp01(color.g * Mul.y + Add.y),
|
||||
Mathf.Clamp01(color.b * Mul.z + Add.z),
|
||||
Mathf.Clamp01(color.a * Mul.w + Add.w));
|
||||
}
|
||||
|
||||
public static SwfColorTransData identity {
|
||||
get {
|
||||
return new SwfColorTransData{
|
||||
|
||||
Reference in New Issue
Block a user