effectmaster.h 1.85 KB
Newer Older
魔大农's avatar
魔大农 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* Quatter
// Copyright (C) 2016 LucKey Productions (luckeyproductions.nl)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

19 20 21 22 23 24
#ifndef EFFECTMASTER_H
#define EFFECTMASTER_H

#include <Urho3D/Urho3D.h>
#include "master.h"

魔大农's avatar
魔大农 committed
25 26
#define WAYPOINTS 42

27 28 29 30 31 32
class EffectMaster : public Master
{
    URHO3D_OBJECT(EffectMaster, Master);
public:
    EffectMaster();

33
    void FadeTo(Material* material, Color color, float duration = 0.23f, float delay = 0.0f);
34
    void FadeTo(Light* light, float brightness, float duration = 0.23f);
魔大农's avatar
魔大农 committed
35
    void FadeTo(SoundSource* soundSource, float gain, float duration = 2.3f);
魔大农's avatar
魔大农 committed
36

37
    void FadeOut(Material* material, float duration = 0.23f) {FadeTo(material, material->GetShaderParameter("MatDiffColor").GetColor() * 0.0f, duration); }
魔大农's avatar
魔大农 committed
38
    void FadeOut(Light* light) { FadeTo(light, 0.0f); }
魔大农's avatar
魔大农 committed
39
    void FadeOut(SoundSource* soundSource, float duration = 5.0f);
魔大农's avatar
魔大农 committed
40

魔大农's avatar
魔大农 committed
41
    void TransformTo(Node* node, Vector3 pos, Quaternion rot = Quaternion::IDENTITY, float duration = 1.0f);
魔大农's avatar
魔大农 committed
42
    void ArchTo(Node* node, Vector3 pos, Quaternion rot, float archHeight = 2.3f, float duration = 1.0f, float delay = 0.0f);
魔大农's avatar
魔大农 committed
43
    float Arch(float t) const noexcept { return 1.0f - pow(2.0f * (t-0.5f), 4.0f); }
44 45 46
};

#endif // EFFECTMASTER_H