summaryrefslogtreecommitdiffstats
path: root/src/Runtime/Source/UIPParser/Include/Qt3DSIPresentation.h
blob: 00f3d15a657f318b4adfcae8ef19f595a697b5f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/****************************************************************************
**
** Copyright (C) 1993-2009 NVIDIA Corporation.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt 3D Studio.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#pragma once

//==============================================================================
//	Includes
//==============================================================================
#include "Qt3DSEventCallbacks.h"

namespace qt3ds {
namespace runtime {
    class IApplication;
    class IActivityZone;
    class IAnimationSystem;
    class ISlideSystem;
    class ILogicSystem;
    class IParametersSystem;
}
}

namespace qt3ds {
namespace foundation {
    class IStringTable;
}
}

//==============================================================================
//	Namespace
//==============================================================================
namespace Q3DStudio {

//==============================================================================
//	Forwards
//==============================================================================
class IComponentManager;
class IEventManager;
class IScene;
class IScriptBridge;
class CPresentationFrameData;
class CTimePolicy;
using qt3ds::runtime::ISlideSystem;
using qt3ds::runtime::IAnimationSystem;
using qt3ds::runtime::ILogicSystem;
using qt3ds::runtime::IParametersSystem;

//==============================================================================
//	Enumeration
//==============================================================================
/// Method used to translate from presentation size to window size
enum EScaleMode {
    SCALEMODE_FREE, ///< Free scaling mode
    SCALEMODE_EXACT, ///< Fixed presentation size
    SCALEMODE_ASPECT, ///< Maintain aspect ratio
    SCALEMODE_UNKNOWN, ///< ERROR! - Uninitialized scale mode
};

//==============================================================================
//	Structs
//==============================================================================
struct SPresentationSize
{
    SPresentationSize()
        : m_Width(0)
        , m_Height(0)
        , m_ScaleMode(0)
    {
    }
    UINT16 m_Width; ///< Native width of the presentation
    UINT16 m_Height; ///< Native height of the presentation
    UINT8 m_ScaleMode; ///< Presentation to window scale method
    UINT8 m_Padding[3];
};

//==============================================================================
/**
 *	@interface	IPresentation
 *	Base interface of the presentation.
 */
class IPresentation
{
    //==============================================================================
    //	Methods
    //==============================================================================
public: // Construction
    IPresentation() {}
    virtual ~IPresentation() {}

public: // Execution
    virtual void ClearDirtyList() = 0;
    virtual void PreUpdate(const TTimeUnit inGlobalTime) = 0;
    virtual void BeginUpdate() = 0;
    virtual void EndUpdate() = 0;
    virtual void PostUpdate(const TTimeUnit inGlobalTime) = 0;

public: // Bridge Control
    virtual void SetScene(IScene *inScene) = 0;
    virtual IScene *GetScene() const = 0;
    virtual IScriptBridge *GetScriptBridgeQml() = 0;

public: // Commands and Events
    virtual void FireEvent(const TEventCommandHash inEventType, TElement *inTarget,
                           const UVariant *inArg1 = NULL, const UVariant *inArg2 = NULL,
                           const EAttributeType inType1 = ATTRIBUTETYPE_NONE,
                           const EAttributeType inType2 = ATTRIBUTETYPE_NONE) = 0;
    virtual void FireCommand(const TEventCommandHash inEventType, TElement *inTarget,
                             const UVariant *inArg1 = NULL, const UVariant *inArg2 = NULL,
                             const EAttributeType inType1 = ATTRIBUTETYPE_NONE,
                             const EAttributeType inType2 = ATTRIBUTETYPE_NONE) = 0;
    virtual void FlushEventCommandQueue(void) = 0;
    virtual void ProcessEvent(SEventCommand &) = 0;

public: // Manager Access
    virtual IComponentManager &GetComponentManager() = 0;
    virtual ISlideSystem &GetSlideSystem() = 0;
    virtual IAnimationSystem &GetAnimationSystem() = 0;
    virtual ILogicSystem &GetLogicSystem() = 0;
    virtual IParametersSystem &GetParametersSystem() = 0;

    virtual qt3ds::foundation::IStringTable &GetStringTable() = 0;
    virtual qt3ds::runtime::IApplication &GetApplication() = 0;
    virtual qt3ds::runtime::IActivityZone *GetActivityZone() = 0;

public: // Hooks and callbacks
    virtual void OnPresentationLoaded() = 0;

public: // Full file path
    virtual void SetFilePath(const CHAR *inPath) = 0;
    virtual QString GetFilePath() = 0;
    virtual TElement *GetRoot() = 0;
    virtual void SetRoot(TElement &inRoot) = 0;

public: // Configuration access
    virtual SPresentationSize GetSize() const = 0;
    virtual void SetSize(const SPresentationSize &inSize) = 0;
    virtual void SetElementPath(TElement &inElement, const char8_t *inPath) = 0;
    virtual qt3ds::foundation::CRegisteredString GetElementPath(TElement &inElement) = 0;

public: // Event Callbacks
    virtual void RegisterEventCallback(TElement *inElement, const TEventCommandHash inEventHash,
                                       const TEventCallback inCallback, void *inContextData) = 0;
    virtual BOOL UnregisterEventCallback(TElement *inElement, const TEventCommandHash inEventHash,
                                         const TEventCallback inCallback, void *inContextData) = 0;

public: // FrameData access
    virtual CPresentationFrameData &GetFrameData() = 0;
};

} // namespace Q3DStudio