1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtCanvas3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qcanvas3d_plugin.h" |
41 | |
42 | #include <QtQml/qqml.h> |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | QT_CANVAS3D_BEGIN_NAMESPACE |
47 | |
48 | QtCanvas3DPlugin::QtCanvas3DPlugin(QObject *parent) : QQmlExtensionPlugin(parent) |
49 | { |
50 | } |
51 | |
52 | void QtCanvas3DPlugin::registerTypes(const char *uri) |
53 | { |
54 | // @uri com.digia.qtcanvas3d |
55 | |
56 | // QtCanvas3D 1.0 |
57 | |
58 | // QTCANVAS3D CORE API |
59 | qmlRegisterSingletonType<CanvasTextureImageFactory>(uri, |
60 | versionMajor: 1, versionMinor: 0, |
61 | typeName: "TextureImageFactory" , |
62 | callback: CanvasTextureImageFactory::texture_image_factory_provider); |
63 | |
64 | qmlRegisterUncreatableType<CanvasTextureImage>(uri, |
65 | versionMajor: 1, versionMinor: 0, |
66 | qmlName: "TextureImage" , |
67 | reason: QLatin1String("Trying to create uncreatable: TextureImage, use TextureImageFactory.newTexImage() instead." )); |
68 | qmlRegisterType<Canvas>(uri, |
69 | versionMajor: 1, versionMinor: 0, |
70 | qmlName: "Canvas3D" ); |
71 | qmlRegisterType<CanvasContextAttributes>(uri, |
72 | versionMajor: 1, versionMinor: 0, |
73 | qmlName: "Canvas3DContextAttributes" ); |
74 | qmlRegisterUncreatableType<CanvasShaderPrecisionFormat>(uri, |
75 | versionMajor: 1, versionMinor: 0, |
76 | qmlName: "Canvas3DShaderPrecisionFormat" , |
77 | reason: QLatin1String("Trying to create uncreatable: Canvas3DShaderPrecisionFormat." )); |
78 | qmlRegisterUncreatableType<CanvasContext>(uri, |
79 | versionMajor: 1, versionMinor: 0, |
80 | qmlName: "Context3D" , |
81 | reason: QLatin1String("Trying to create uncreatable: Context3D, use Canvas3D.getContext() instead." )); |
82 | qmlRegisterUncreatableType<CanvasActiveInfo>(uri, |
83 | versionMajor: 1, versionMinor: 0, |
84 | qmlName: "Canvas3DActiveInfo" , |
85 | reason: QLatin1String("Trying to create uncreatable: Canvas3DActiveInfo, use Context3D.getActiveAttrib() or Context3D.getActiveUniform() instead." )); |
86 | qmlRegisterUncreatableType<CanvasTexture>(uri, |
87 | versionMajor: 1, versionMinor: 0, |
88 | qmlName: "Canvas3DTexture" , |
89 | reason: QLatin1String("Trying to create uncreatable: Canvas3DTexture, use Context3D.createTexture() instead." )); |
90 | qmlRegisterUncreatableType<CanvasShader>(uri, |
91 | versionMajor: 1, versionMinor: 0, |
92 | qmlName: "Canvas3DShader" , |
93 | reason: QLatin1String("Trying to create uncreatable: Canvas3DShader, use Context3D.createShader() instead." )); |
94 | qmlRegisterUncreatableType<CanvasFrameBuffer>(uri, |
95 | versionMajor: 1, versionMinor: 0, |
96 | qmlName: "Canvas3DFrameBuffer" , |
97 | reason: QLatin1String("Trying to create uncreatable: Canvas3DFrameBuffer, use Context3D.createFramebuffer() instead." )); |
98 | qmlRegisterUncreatableType<CanvasRenderBuffer>(uri, |
99 | versionMajor: 1, versionMinor: 0, |
100 | qmlName: "Canvas3DRenderBuffer" , |
101 | reason: QLatin1String("Trying to create uncreatable: Canvas3DRenderBuffer, use Context3D.createRenderbuffer() instead." )); |
102 | qmlRegisterUncreatableType<CanvasProgram>(uri, |
103 | versionMajor: 1, versionMinor: 0, |
104 | qmlName: "Canvas3DProgram" , |
105 | reason: QLatin1String("Trying to create uncreatable: Canvas3DProgram, use Context3D.createProgram() instead." )); |
106 | qmlRegisterUncreatableType<CanvasBuffer>(uri, |
107 | versionMajor: 1, versionMinor: 0, |
108 | qmlName: "Canvas3DBuffer" , |
109 | reason: QLatin1String("Trying to create uncreatable: Canvas3DBuffer, use Context3D.createBuffer() instead." )); |
110 | qmlRegisterUncreatableType<CanvasUniformLocation>(uri, |
111 | versionMajor: 1, versionMinor: 0, |
112 | qmlName: "Canvas3DUniformLocation" , |
113 | reason: QLatin1String("Trying to create uncreatable: Canvas3DUniformLocation, use Context3D.getUniformLocation() instead." )); |
114 | |
115 | // EXTENSIONS |
116 | qmlRegisterUncreatableType<CanvasGLStateDump>(uri, |
117 | versionMajor: 1, versionMinor: 0, |
118 | qmlName: "GLStateDumpExt" , |
119 | reason: QLatin1String("Trying to create uncreatable: GLStateDumpExt, use Context3D.getExtension(\"QTCANVAS3D_gl_state_dump\") instead." )); |
120 | |
121 | // QtCanvas3D 1.1 |
122 | |
123 | // New revisions |
124 | qmlRegisterType<Canvas, 1>(uri, versionMajor: 1, versionMinor: 1, qmlName: "Canvas3D" ); |
125 | |
126 | // New types |
127 | qmlRegisterUncreatableType<CanvasTextureProvider>(uri, |
128 | versionMajor: 1, versionMinor: 1, |
129 | qmlName: "Canvas3DTextureProvider" , |
130 | reason: QLatin1String("Trying to create uncreatable: Canvas3DTextureProvider, use Context3D.getExtension(\"QTCANVAS3D_texture_provider\") instead." )); |
131 | } |
132 | |
133 | QT_CANVAS3D_END_NAMESPACE |
134 | |
135 | QT_END_NAMESPACE |
136 | |