Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.h
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 138 | private: | |||
---|---|---|---|---|---|
143 | GLuint vao; | 143 | GLuint vao; | ||
144 | }; | 144 | }; | ||
145 | 145 | | |||
146 | class OpenGLWindowPixmap; | 146 | class OpenGLWindowPixmap; | ||
147 | 147 | | |||
148 | class OpenGLWindow final : public Scene::Window | 148 | class OpenGLWindow final : public Scene::Window | ||
149 | { | 149 | { | ||
150 | public: | 150 | public: | ||
151 | enum Leaf { ShadowLeaf = 0, DecorationLeaf, ContentLeaf, PreviousContentLeaf, LeafCount }; | 151 | enum Leaf { ShadowLeaf, DecorationLeaf, ContentLeaf, PreviousContentLeaf }; | ||
152 | 152 | | |||
153 | struct LeafNode | 153 | struct RenderNode | ||
154 | { | 154 | { | ||
155 | LeafNode() | 155 | RenderNode() | ||
156 | : texture(nullptr), | 156 | : texture(nullptr) | ||
157 | firstVertex(0), | 157 | , firstVertex(0) | ||
158 | vertexCount(0), | 158 | , vertexCount(0) | ||
159 | opacity(1.0), | 159 | , opacity(1.0) | ||
160 | hasAlpha(false), | 160 | , hasAlpha(false) | ||
161 | coordinateType(UnnormalizedCoordinates) | 161 | , coordinateType(UnnormalizedCoordinates) | ||
162 | { | 162 | { | ||
163 | } | 163 | } | ||
164 | 164 | | |||
165 | GLTexture *texture; | 165 | GLTexture *texture; | ||
166 | WindowQuadList quads; | ||||
166 | int firstVertex; | 167 | int firstVertex; | ||
167 | int vertexCount; | 168 | int vertexCount; | ||
168 | float opacity; | 169 | float opacity; | ||
169 | bool hasAlpha; | 170 | bool hasAlpha; | ||
170 | TextureCoordinateType coordinateType; | 171 | TextureCoordinateType coordinateType; | ||
172 | Leaf leafType; | ||||
173 | }; | ||||
174 | | ||||
175 | struct RenderContext | ||||
176 | { | ||||
177 | QVector<RenderNode> renderNodes; | ||||
178 | int shadowOffset = 0; | ||||
179 | int decorationOffset = 0; | ||||
180 | int contentOffset = 0; | ||||
181 | int previousContentOffset = 0; | ||||
182 | int quadCount = 0; | ||||
171 | }; | 183 | }; | ||
172 | 184 | | |||
173 | OpenGLWindow(Toplevel *toplevel, SceneOpenGL *scene); | 185 | OpenGLWindow(Toplevel *toplevel, SceneOpenGL *scene); | ||
174 | ~OpenGLWindow() override; | 186 | ~OpenGLWindow() override; | ||
175 | 187 | | |||
176 | WindowPixmap *createWindowPixmap() override; | 188 | WindowPixmap *createWindowPixmap() override; | ||
177 | void performPaint(int mask, const QRegion ®ion, const WindowPaintData &data) override; | 189 | void performPaint(int mask, const QRegion ®ion, const WindowPaintData &data) override; | ||
178 | 190 | | |||
179 | private: | 191 | private: | ||
180 | QMatrix4x4 transformation(int mask, const WindowPaintData &data) const; | 192 | QMatrix4x4 transformation(int mask, const WindowPaintData &data) const; | ||
181 | GLTexture *getDecorationTexture() const; | 193 | GLTexture *getDecorationTexture() const; | ||
182 | QMatrix4x4 modelViewProjectionMatrix(int mask, const WindowPaintData &data) const; | 194 | QMatrix4x4 modelViewProjectionMatrix(int mask, const WindowPaintData &data) const; | ||
183 | QVector4D modulate(float opacity, float brightness) const; | 195 | QVector4D modulate(float opacity, float brightness) const; | ||
184 | void setBlendEnabled(bool enabled); | 196 | void setBlendEnabled(bool enabled); | ||
185 | void setupLeafNodes(LeafNode *nodes, const WindowQuadList *quads, const WindowPaintData &data); | 197 | void initializeRenderContext(RenderContext &context, const WindowPaintData &data); | ||
186 | void renderSubSurface(GLShader *shader, const QMatrix4x4 &mvp, const QMatrix4x4 &windowMatrix, | | |||
187 | OpenGLWindowPixmap *pixmap, const QRegion ®ion, bool hardwareClipping); | | |||
188 | bool beginRenderWindow(int mask, const QRegion ®ion, WindowPaintData &data); | 198 | bool beginRenderWindow(int mask, const QRegion ®ion, WindowPaintData &data); | ||
189 | void endRenderWindow(); | 199 | void endRenderWindow(); | ||
190 | bool bindTexture(); | 200 | bool bindTexture(); | ||
191 | 201 | | |||
192 | SceneOpenGL *m_scene; | 202 | SceneOpenGL *m_scene; | ||
193 | bool m_hardwareClipping = false; | 203 | bool m_hardwareClipping = false; | ||
194 | bool m_blendingEnabled = false; | 204 | bool m_blendingEnabled = false; | ||
195 | }; | 205 | }; | ||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |