mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2026-01-04 15:36:54 +07:00
cut invisible geometry
This commit is contained in:
@@ -208,7 +208,7 @@ namespace FlashTools.Internal {
|
|||||||
var bitmap = inst != null
|
var bitmap = inst != null
|
||||||
? FindBitmapFromAssetData(asset.Data, inst.Bitmap)
|
? FindBitmapFromAssetData(asset.Data, inst.Bitmap)
|
||||||
: null;
|
: null;
|
||||||
if ( bitmap != null ) {
|
if ( bitmap != null && IsVisibleInstance(inst) ) {
|
||||||
var width = bitmap.RealSize.x / 20.0f;
|
var width = bitmap.RealSize.x / 20.0f;
|
||||||
var height = bitmap.RealSize.y / 20.0f;
|
var height = bitmap.RealSize.y / 20.0f;
|
||||||
|
|
||||||
@@ -335,6 +335,11 @@ namespace FlashTools.Internal {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsVisibleInstance(SwfInstanceData inst) {
|
||||||
|
var result_color = inst.ColorTrans.ApplyToColor(Color.white);
|
||||||
|
return result_color.a >= 0.01f;
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ConfigureAssetClips
|
// ConfigureAssetClips
|
||||||
|
|||||||
@@ -42,6 +42,14 @@ namespace FlashTools {
|
|||||||
public Vector4 Mul;
|
public Vector4 Mul;
|
||||||
public Vector4 Add;
|
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 {
|
public static SwfColorTransData identity {
|
||||||
get {
|
get {
|
||||||
return new SwfColorTransData{
|
return new SwfColorTransData{
|
||||||
|
|||||||
Reference in New Issue
Block a user