Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds)

This commit is contained in:
2017-05-16 03:07:26 +07:00
parent 26e30e45f2
commit f9b9acd3b7
4 changed files with 32 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
* Fix optimizator bitmap trim problems
* Fix Unity 5.6 submesh sorting bug
* Add shape tween warning
* Add SwfClip bounds functions (currentLocalBounds, currentWorldBounds)
* Remove excess "if" instruction from shaders
###### Version 1.3.7

View File

@@ -190,6 +190,34 @@ namespace FTRuntime {
}
}
/// <summary>
/// Gets the current frame mesh bounding volume in local space
/// (Since 1.3.8)
/// </summary>
/// <value>The bounding volume in local space</value>
public Bounds currentLocalBounds {
get {
var frame = GetCurrentBakedFrame();
return frame != null
? frame.CachedMesh.bounds
: new Bounds();
}
}
/// <summary>
/// Gets the current frame mesh bounding volume in world space
/// (Since 1.3.8)
/// </summary>
/// <value>The bounding volume in world space</value>
public Bounds currentWorldBounds {
get {
Internal_UpdateMesh();
return _meshRenderer
? _meshRenderer.bounds
: new Bounds();
}
}
// ---------------------------------------------------------------------
//
// Functions
@@ -255,7 +283,7 @@ namespace FTRuntime {
//
// ---------------------------------------------------------------------
internal void Internal_LateUpdate() {
internal void Internal_UpdateMesh() {
if ( _meshFilter && _meshRenderer && _dirtyMesh ) {
var baked_frame = GetCurrentBakedFrame();
if ( baked_frame != null ) {

View File

@@ -262,7 +262,7 @@ namespace FTRuntime {
for ( int i = 0, e = _clips.Count; i < e; ++i ) {
var clip = _clips[i];
if ( clip ) {
clip.Internal_LateUpdate();
clip.Internal_UpdateMesh();
}
}
}