cut invisible geometry

This commit is contained in:
2016-09-14 01:16:50 +07:00
parent dc539b1e27
commit d1777239cd
2 changed files with 14 additions and 1 deletions

View File

@@ -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

View File

@@ -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{