コード例 #1
0
ファイル: InstanceModel.cs プロジェクト: damian-666/ReignSDK
        public InstanceModel(Model model)
        {
            Model        = model;
            PlaySpeed    = 1;
            CurrentFrame = model.FrameStart;

            // orientation
            Position = Vector3.Zero;
            Scale    = Vector3.One;
            Rotation = Matrix3.Identity;

            // objects
            Objects = new InstanceObject[model.Objects.Length];
            for (int i = 0; i != Objects.Length; ++i)
            {
                var type = model.Objects[i].GetType();
                if (type == typeof(ObjectMesh))
                {
                    Objects[i] = new InstanceObjectMesh((ObjectMesh)model.Objects[i]);
                }
                else if (type == typeof(ObjectArmature))
                {
                    Objects[i] = new InstanceObjectArmature((ObjectArmature)model.Objects[i]);
                }
                else
                {
                    Debug.ThrowError("InstanceModel", "Unsuported Object type: " + type);
                }
            }

            for (int i = 0; i != Objects.Length; ++i)
            {
                Objects[i].bindObjects(model.Objects[i]);
            }
        }
コード例 #2
0
        public InstanceModel(Model model)
        {
            Model = model;
            PlaySpeed = 1;
            CurrentFrame = model.FrameStart;

            // orientation
            Position = Vector3.Zero;
            Scale = Vector3.One;
            Rotation = Matrix3.Identity;

            // objects
            Objects = new InstanceObject[model.Objects.Length];
            for (int i = 0; i != Objects.Length; ++i)
            {
                var type = model.Objects[i].GetType();
                if (type == typeof(ObjectMesh)) Objects[i] = new InstanceObjectMesh((ObjectMesh)model.Objects[i]);
                else if (type == typeof(ObjectArmature)) Objects[i] = new InstanceObjectArmature((ObjectArmature)model.Objects[i]);
                else Debug.ThrowError("InstanceModel", "Unsuported Object type: " + type);
            }

            for (int i = 0; i != Objects.Length; ++i)
            {
                Objects[i].bindObjects(model.Objects[i]);
            }
        }