VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Graphic.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GRAPHIC_H
18 #define GRAPHIC_H
19 
20 #include <QQuickItem>
21 
22 class RenderList;
23 
34 class Graphic : public QQuickItem {
35  Q_OBJECT
36 public:
41  explicit Graphic(QQuickItem* parent = nullptr);
47  virtual void synchronizeForRendering(RenderList* renderList);
48 
49 protected:
61  float rotation = 0.0f;
66  float opacity = 1.0f;
70  float zDepth = 0.0f;
71  };
84 
85 private:
86  void getFlattenedRenderParametersRecursive(QQuickItem* root, QQuickItem* item,
87  RenderParameters* parameters);
88 };
89 Q_DECLARE_METATYPE(Graphic*)
90 
91 #endif // GRAPHIC_H
Graphic(QQuickItem *parent=nullptr)
Construct a Graphic.
QPointF worldPosition
World position of this Graphic.
Definition: Graphic.h:57
float rotation
Rotation in world space of this Graphic.
Definition: Graphic.h:61
Base class for visual elements which are part of the game scene, and are rendered through Renderer...
Definition: Graphic.h:34
float zDepth
Z-depth of this Graphic, to be used for sorting.
Definition: Graphic.h:70
Struct containing the accumulated result of getFlattenedRenderParameters().
Definition: Graphic.h:53
virtual void synchronizeForRendering(RenderList *renderList)
Synchronize this Graphic for rendering, adding any RenderNodes to renderList, and buffering any data ...
void getFlattenedRenderParameters(RenderParameters *parameters)
Compute the rendering parameters and transform of this Graphic by moving up the QQuickItem tree and a...
List of RenderNodes, sorted by z-depth for rendering.
Definition: RenderList.h:36
QObject * parent() const
float opacity
Opacity of this Graphic, with 0.0f being fully transparent, and 1.0f being opaque.
Definition: Graphic.h:66