/**
* The MIT License (MIT)
*
* Copyright (c) 2012-2017 DragonBones team and other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace DragonBones
{
///
/// - The base class of the transform object.
///
///
/// DragonBones 4.5
/// en_US
///
/// - 变换对象的基类。
///
///
/// DragonBones 4.5
/// zh_CN
public abstract class TransformObject : BaseObject
{
///
protected static readonly Matrix _helpMatrix = new Matrix();
///
protected static readonly TransformDB _helpTransform = new TransformDB();
///
protected static readonly Point _helpPoint = new Point();
///
/// - A matrix relative to the armature coordinate system.
///
/// DragonBones 3.0
/// en_US
///
/// - 相对于骨架坐标系的矩阵。
///
/// DragonBones 3.0
/// zh_CN
public readonly Matrix globalTransformMatrix = new Matrix();
///
/// - A transform relative to the armature coordinate system.
///
///
/// DragonBones 3.0
/// en_US
///
/// - 相对于骨架坐标系的变换。
///
///
/// DragonBones 3.0
/// zh_CN
public readonly TransformDB global = new TransformDB();
///
/// - The offset transform relative to the armature or the parent bone coordinate system.
///
///
/// DragonBones 3.0
/// en_US
///
/// - 相对于骨架或父骨骼坐标系的偏移变换。
///
///
/// DragonBones 3.0
/// zh_CN
public readonly TransformDB offset = new TransformDB();
///
public TransformDB origin;
///
public object userData;
///
protected bool _globalDirty;
///
///
internal Armature _armature;
///
protected override void _OnClear()
{
this.globalTransformMatrix.Identity();
this.global.Identity();
this.offset.Identity();
this.origin = null; //
this.userData = null;
this._globalDirty = false;
this._armature = null; //
}
///
/// - For performance considerations, rotation or scale in the {@link #global} attribute of the bone or slot is not always properly accessible,
/// some engines do not rely on these attributes to update rendering, such as Egret.
/// The use of this method ensures that the access to the {@link #global} property is correctly rotation or scale.
///
///
/// TypeScript style, for reference only.
///
/// bone.updateGlobalTransform();
/// let rotation = bone.global.rotation;
///